摘要: 读以下文件,请问 fgets 共执行了多少次? fgets(buf,10,fp); 1234567890abcdefg 第一次:1-9补\0 第二次:0abcdefg\n补\0 1234567890 第三次:123456789补\0 第四次:0\n补\0 abcdefgEOF 第五次:abcdefg... 阅读全文
posted @ 2018-08-14 20:06 2018年8月10日注册 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 1 //使用fgetc()/fputc()实现文件的加密与解密,存在溢出风险。 2 #include 3 #define F_PRINT_ERR(e)\ 4 do\ 5 {\ 6 if(e == NULL)\ 7 {\ 8 printf("open error");\ 9 exit(-1);\ 10 }\ 11 }\ 12 wh... 阅读全文
posted @ 2018-08-14 16:34 2018年8月10日注册 阅读(276) 评论(0) 推荐(0) 编辑
摘要: 1 //判断读到文件末尾 2 #include 3 #define F_PRINT_ERR(e)\ 4 do\ 5 {\ 6 if(e == NULL)\ 7 {\ 8 printf("open error");\ 9 exit(-1);\ 10 }\ 11 }\ 12 while(0) 13 int main(int argc... 阅读全文
posted @ 2018-08-14 16:17 2018年8月10日注册 阅读(340) 评论(0) 推荐(0) 编辑
摘要: 1 //用fgetc()/fputc()实现文件的拷贝 2 #include 3 #define F_PRINT_ERR(e)\ 4 do\ 5 {\ 6 if(e == NULL)\ 7 {\ 8 printf("open error");\ 9 exit(-1);\ 10 }\ 11 }\ 12 while(0) 13 in... 阅读全文
posted @ 2018-08-14 14:33 2018年8月10日注册 阅读(423) 评论(0) 推荐(0) 编辑
摘要: #include int main(void) { //已知几个数组的定义及其初始化 char str1[] = "str1"; char str2[] = "str2"; char str3[] = "str3"; char *a[] = {str1,str2,str3}; char *b[] = {"aaa","bbbb","ccccc"... 阅读全文
posted @ 2018-08-14 12:29 2018年8月10日注册 阅读(132) 评论(0) 推荐(0) 编辑