摘要: #include#define SIZE 10struct student{ char name[10]; int num; int age; char addr[15];}stu[SIZE];//保存数据(fwrite)void save(){ FILE *fp; fp = fopen("stu.... 阅读全文
posted @ 2015-08-06 22:05 XYQ全哥 阅读(7890) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> int main(int argc,char *argv[]) { //检查用户的参数是否正确 if(argc<3) { printf("用法:命令 源文件名 目标文件名\n"); return -1; } //先打开源文件 FILE *fin = fopen(a 阅读全文
posted @ 2015-08-06 18:58 XYQ全哥 阅读(2827) 评论(0) 推荐(0) 编辑
摘要: #include#includeint main(){ //定义文件指针 FILE *f = NULL; //打开文件 f = fopen("1.txt","wt"); if(f==NULL) { printf("文件读取失败!\n"); return -1; } char buf[1024]; /... 阅读全文
posted @ 2015-08-06 18:51 XYQ全哥 阅读(1783) 评论(0) 推荐(0) 编辑
摘要: #includeint main(){//定义文件指针FILE *f = NULL; //打开文件f = fopen("1.txt","r");if(f==NULL){printf("文件读取失败!\n");return -1;} //读文件const int SIZE = 100;char bu... 阅读全文
posted @ 2015-08-06 18:49 XYQ全哥 阅读(1584) 评论(0) 推荐(0) 编辑
摘要: /*文件的几种操作模式: r:只读 w:只写 rw:可读可写文件的分类: t:文本文件(字符文件) b:二进制文件(字节文件)注意:采用只读方式打开文件时,如果源文件不存在,打开文件会失败!采用只写方式打开文件时,不管源文件存不存在,都不会失败。(因为会自动创建一个文件)采用可读可写方式打开文... 阅读全文
posted @ 2015-08-06 18:40 XYQ全哥 阅读(1005) 评论(0) 推荐(0) 编辑
摘要: 建立完整的单向链表 阅读全文
posted @ 2015-08-06 12:49 XYQ全哥 阅读(2583) 评论(0) 推荐(0) 编辑