摘要: 1 //读写结构体 2 #include 3 typedef struct student 4 { 5 int num; 6 char name[30]; 7 char sex; 8 float math; 9 float english; 10 float chinese; 11 12 }Stu; ... 阅读全文
posted @ 2018-08-15 16:32 2018年8月10日注册 阅读(3854) 评论(0) 推荐(0) 编辑
摘要: //使用fread()/fwrite()实现对文件的加密与解密 /* 程序使用方法: 加密用法-> 程序名 -c src dest 解密用法-> 程序名 -d src dest argv[0] argv[1] argv[2] argv[3] */ #define F_PRINT_ERR(e)\ do\ {\ if(... 阅读全文
posted @ 2018-08-15 15:27 2018年8月10日注册 阅读(366) 评论(0) 推荐(0) 编辑
摘要: text.txt文件的内容如下:每一行只有一个等号,且没有空行。——————————————————————a = 3 b = 4c = 90 d= 20e = 25 f =73 g=89——————————————————————text2.txt文件的内容如下:每行可能有多个等号,且会有空行。— 阅读全文
posted @ 2018-08-15 14:11 2018年8月10日注册 阅读(515) 评论(0) 推荐(0) 编辑
摘要: 1 #define F_PRINT_ERR(e)\ 2 do\ 3 {\ 4 if(e == NULL)\ 5 {\ 6 printf("open error");\ 7 exit(-1);\ 8 }\ 9 }\ 10 while(0) 11 int main(void) 12 { 13 FILE *pf = fopen(... 阅读全文
posted @ 2018-08-15 12:37 2018年8月10日注册 阅读(317) 评论(0) 推荐(0) 编辑
摘要: 读以下文件,请问 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) 编辑