C/C++之读写文件
来源:互联网 发布:怎么加入淘宝类目群 编辑:程序博客网 时间:2024/05/02 01:56
#include <iostream>//write a Line by Linebool writeALinebyLine(){FILE* fp_write;fopen_s(&fp_write, "test.txt", "wb");if (fp_write != NULL){char buf[1024] = {};for (int i = 0; i < 100; i++){sprintf_s(buf, "测试写文件行数为:%d\r\n", i);fwrite(buf, strlen(buf), 1, fp_write);}fclose(fp_write);return true;}return false;}//read a Line by Linebool readALinebyLine(){FILE* fp_read;fopen_s(&fp_read, "test.txt", "rb");if (fp_read != NULL){char buf[1024] = {};while (!feof(fp_read)){fgets(buf, 1024, fp_read);printf("%s", buf);}fclose(fp_read);return true;}return false;}void main(){//write a Line by Linebool bWriteret = writeALinebyLine();//read a Line by Linebool bReadret = readALinebyLine();}
阅读全文
0 0
- C语言之文件读写
- C/C++之读写文件
- 【C/C++】文件读写
- C文件之三 文件的读写
- C和C++文件读写之异同
- C文件之二 字符串读写
- C/C++学习之C提高-----文件操作,C程序读写文件、配置文件读写案例
- C++/C 文件二进制读写
- C++/C 文件二进制读写
- c语言读写文件
- 文件读写(c)
- C#-读写INI文件
- [C++]文件读写操作
- C#读写INI文件
- C 读写文件
- C读写ini文件
- c#FileStream文件读写
- 读写文件 c
- nginx 出现413 Request Entity Too Large问题的解决方法 标签: nginxphpuploadrequesttoo large 2015-05-07 00:07 704
- Jquery操作checkbox复选框
- 19AWorld Football Cup
- winsows10下用ninja编译配置caffe
- Mysql 默认密码
- C/C++之读写文件
- cocos2d-x 在安卓平台上 pvr.gz 资源文件异常问题
- python文件定位读取
- 谈谈8年C++面向对象设计的经验体会
- caffe 在 windows 下的配置(scripts\build_win.cmd)
- SSL P2324 细胞问题 题目
- Automatic fall detection of human in video using combination of features译文
- Hdoj 2673 shǎ崽 OrOrOrOrz
- Gym