c++初试-文件流(9)

来源:互联网 发布:wit.ai api.ai 知乎 编辑:程序博客网 时间:2024/05/29 19:23
/* * file.cpp * *  Created on: 2014年10月31日 *      Author: Administrator */#include<iostream>#include<fstream>#include<string>using namespace std;int main(){//写文件string filename = "E:/aa.txt";ofstream fout(filename.c_str());fout << "hello world" << endl;fout.close();//读文件ifstream fin("E:/aa.txt");char ch;while(fin.get(ch)){cout << ch;}cout << endl;fin.close();return 0;}

0 0
原创粉丝点击