![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
字符串
文章平均质量分 79
linbounconstraint
这个作者很懒,什么都没留下…
展开
-
QT字符串 转换大汇总
uchar数组 和 char数组 互转#include <stdio.h>#include <string.h>void convert_uchar_to_char(unsigned char* in_uchar, char* out_char, int uc_len){ int i=0; char c[2]; char out_char_tmp[102...原创 2019-10-23 09:27:59 · 1361 阅读 · 0 评论 -
C语言十六进制和十进制互转
#include<stdio.h>int main(void){ int i; char buf[64] = {0}; //scanf("%d",&i); i = 32; printf("dec:%d\n",i); sprintf(buf,"0x%04x",i); printf("hex:%s\n",buf); printf("-------------...原创 2019-06-12 11:26:21 · 4408 阅读 · 0 评论 -
C语言去除字符串首尾空格,trim()函数实现
C语言去除字符串首尾空格,trim()函数实现 https://blog.csdn.net/u013022032/article/details/50521465/*C语言去除字符串首尾空格,trim()函数实现https://blog.csdn.net/u013022032/article/details/50521465*/#include &lt;stdio.h&gt;...原创 2018-07-02 15:23:29 · 19375 阅读 · 1 评论 -
string.c
//拼接字符串,把p2拼到p1后面char *mystrcat(char *p1,const char *p2){ if (p1 == NULL || p2 == NULL) return NULL; char *q = p1; while (*p1 != '\0') p1++; while ((*p1++ = *p2++) !=...原创 2015-10-17 19:59:21 · 388 阅读 · 0 评论 -
(转)C语言函数sscanf()的用法
链接C语言函数sscanf()的用法 在我的学习过程中,从文件读取数据是一件很麻烦的事,所幸有sscanf()函数。 C语言函数sscanf()的用法sscanf() - 从一个字符串中读进与指定格式相符的数据. 函数原型: int sscanf( string str, string fmt, mixed var1, mixed var原创 2015-11-05 16:34:58 · 416 阅读 · 0 评论 -
简单 time I/O 写入日志文件 get_time
#if 0#ifndef _TM_DEFINEDstruct tm {int tm_sec; /* 秒 – 取值区间为[0,59] */int tm_min; /* 分 - 取值区间为[0,59] */int tm_hour; /* 时 - 取值区间为[0,23] */int tm_mday; /* 一个月中的日期 - 取值区间为[1,31] */int tm_mon; /* 月份原创 2014-08-23 18:57:39 · 538 阅读 · 0 评论 -
sscanf()的用法和例子
%[ ] 的用法:%[ ]表示要读入一个字符集合, 如果[ 后面第一个字符是”^”,则表示反意思。 [ ]内的字符串可以是1或更多字符组成。空字符集(%[])是违反规定的,可 导致不可预知的结果。%[^]也是违反规定的。 %[a-z] 读取在 a-z 之间的字符串,如果不在此之前则停止转载 2014-11-05 19:16:52 · 455 阅读 · 0 评论 -
基于xinetd的web服务器
#include #include #include #include #include #include #include #include #include #define SERVER_NAME "xhttpd"#define PROTOCOL "HTTP/1.1"#define SERVER_URL "http://www.akaedu.com/"#define原创 2014-11-06 11:06:16 · 727 阅读 · 0 评论 -
mystr函数 mystrcpy mystrncmp mystrtok mystrlen
//mystrcpy#include char *mystrcpy(char *dest, char *src){ int i; for(i = 0; (dest[i] = src[i]); i++){ ; //当src[i] = "\0" 表达式为0,0为假,条件不成立,跳出循环 } return dest;}int main(int argc, cha原创 2014-07-22 21:00:32 · 1574 阅读 · 0 评论 -
常用的字符串函数 strspn strcspn
strsp原创 2014-07-22 14:09:19 · 647 阅读 · 0 评论 -
并归排序的实现和简单分析
//将两排列有序的字符串进行有序合并#include #include #include char *hb(char *dest, char *s1, char *s2){ int i, j , k; i = j = k = 0; while( s1[i] && s2[j] ){ if(s1[i] < s2[j]){ dest[k++] = s1[i++]; }e原创 2014-08-11 20:53:05 · 471 阅读 · 0 评论 -
myatoi, mystcmp, mystrcasecmp,mystrncmp
/****************************************int atoi(char *s):不能转换则返回0将字符串s转为int整数atoi(“123”) :结论为123atoi(“12ab”):结论为12atoi(“ab”):结论为0*****************************************///***********myato原创 2014-07-24 15:33:15 · 579 阅读 · 0 评论 -
mystrtok, strspn, strcspn
/*自己实现库函数:strtok*/#include #include char *mystrtok(char *src, char *delim){ char *begin, *end; static char *savep = ""; begin = src ? src : savep; begin = begin + strspn(begin, delim); i原创 2014-07-24 15:36:50 · 562 阅读 · 0 评论