
C语言学习
蓑衣夜行
不断学习,不断进步,成为一个手艺人
展开
-
自己动手写字符串库函数 二(C语言实现)
接着上一篇的自己动手写字符串你库函数 一(C语言),接着往下面写 //具体实现 string.c //追加字符 void Append_Char(string*strs, const char ch) { if (IsEmpty(strs) != 0 && ch != NULL) { int strLen = my_StrLen(strs->str); //需要重新分配空间 st原创 2015-01-05 22:46:41 · 750 阅读 · 0 评论 -
自己动手写字符串库函数 四(C语言实现)
上一篇 自己动手写字符串库函数 三(C语言) //重置 void my_StrSet(string *des, const char ch) { if (!IsEmpty(des)) return; else { char* des1 = des->str; int desLen = my_StrLen(des->str); while (desLen--) *原创 2015-01-20 23:03:28 · 763 阅读 · 0 评论 -
自己动手写字符串库函数 三(C语言实现)
//子串同母串比较 是否在母串中 第二种方法 char* my_FindStr(char*des, char*sour) { char*des1 = des - 1; char*sour1 = NULL; int desLen = strlen(des); int sourLen = strlen(sour); if (des == NULL || sour == NULL) re原创 2015-01-11 23:14:39 · 930 阅读 · 0 评论 -
自己动手写字符串库函数 一(C语言实现)
在coding中最常使用的就是对于字符串的处理问题,接下来我们自己动手写库函数,尽量使用指针操作,而不是数组操作 //头文件 string.h #include #include //定义 字符串结构体 typedef struct CString { char* str; int len; }string;原创 2015-01-01 12:29:51 · 3064 阅读 · 0 评论 -
关于二进制文件fread、fwrite函数使用读写
环境:vs2013 语言:C语言 时间:2015年3月10日 #define _CRT_SECURE_NO_WARNINGS #include #include #define FILENAME "d:/studentInfo" #define COUNT 5 typedef struct { char name[10]; short Math; short Chinese;原创 2015-03-10 22:05:47 · 6058 阅读 · 0 评论 -
二级指针的三种内存模型
/* Level tow point have three cache model */ #include #include int Print(char**pArr); int Print02(char**pArr,int num); int GetMem(char***thirdModel,int len); int Destory(char***thirdModel,int len);原创 2015-03-30 21:04:03 · 756 阅读 · 0 评论 -
多线程copy文件,另加进度条显示
/*more thread copy files*/ #include #include #include #include #include #include #include #include #include #include /*thread number*/ #define T_NUM 5 #define ITEMS 50 typedef struct{ /*o原创 2015-06-12 16:24:09 · 855 阅读 · 0 评论 -
文件重定向dup2函数
/* dup和dup2都可用来复制一个现存的文件描述符,使两个文件描述符指向同一个file结构体。如果 两个文件描述符指向同一个file结构体, File Status Flag和读写位置只保存一份在file结构体中, 并且file结构体的引用计数是2。如果两次open同一文件得到两个文件描述符,则每个描述符对应 一个不同的file结构体,可以有不同的File Status Flag和读写位置。请原创 2015-06-16 10:56:12 · 744 阅读 · 0 评论