c语言结构体与文件知识点总结.doc





《c语言结构体与文件知识点总结.doc》由会员分享,可在线阅读,更多相关《c语言结构体与文件知识点总结.doc(2页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
结构体score1 name1 year1 month1 day1定义struct Student int score; char name10; int year; int month; int day; int age; struct Student stu1;文件保存 读取 FILE * fp处理文件流程 1.打开文件 fopen(); 2.存数据 fprintf 3.关闭文件 fclose FILE * fp; 写入文件1。打开文件 fp=fopen(/Users/shinshen/Desktop/ok.txt, w);2.写数据 fprintf(fp,hello,wo来了);3.关闭文件 fclose(fp); printf(文件写入成功n); 读取文件 1.打开文件 fp=fopen(/Users/shinshen/Desktop/ok.txt, r); 2.读数据 char str100; fscanf(fp, %s,str) 3.关闭文件 fclose(fp);printf(读取文件内容:n %s,str);文件的读写对文件的读和写是最常用的文件操作。在语言中提供了多种文件读写的函数:字符读写函数: fgetc 和 fputc字符串读写函数: fgets 和 fputs数据块读写函数: freed 和 fwrite格式化读写函数: fscanf 和 fprinf
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 语言 结构 文件 知识点 总结

限制150内