c++ 读写
来源:互联网 发布:网络专业大学排名 编辑:程序博客网 时间:2024/05/27 06:12
#include<iostream>#include<string>#include<fstream>>using namespace std;void readfile(){ //逐词读取 ifstream fp("data.txt"); string word; while(fp>>word) { cout<<word<<endl; } fp.close();}void readfile1() { //逐行读取 ifstream fp("data.txt"); string str; while(getline(fp , str)){ cout<<str<<endl; } fp.close();}void writefile(){ ofstream fp("data.txt"); for(int i = 0 ; i <10 ;i++){ fp<<"第" <<i<<"行\n"; } fp.close();}int main(){ readfile(); readfile1(); writefile(); return 0;}
0 0
- 【C/C++】文件读写
- c语言读写文件
- c中文件读写
- C语言读写配置文件
- 文件读写(c)
- 读写文本文件(C#)
- C#-读写INI文件
- C#读写Excel.
- [C++]文件读写操作
- C#,数据库读写XML
- C#,数据库读写XML
- C#读写INI文件
- C 读写文件
- C语言读写
- C读写ini文件
- c#FileStream文件读写
- 读写文件 c
- c语言读写配置文件
- Android界面——对话框的一些事
- spring MVC之构造ModelAndView对象
- 从没跟妹子搭讪
- 代码手写UI,xib和StoryBoard间的博弈,以及Interface Builder的一些小技巧
- hadoop SecondNamenode详解
- c++ 读写
- C++语言中 关键字typedef的作用及其使用规则
- linux 系统调用
- JS创建数组
- 驱动学习第2天 之 最简单的字符设备驱动testchr
- 郑州存量房还够卖半年 放松限购的可能性不大
- 李代沫吸毒案宣判:获刑九个月 罚金两千
- delphi数组地址和VC的区别
- [ALGO-12] 幂方分解