/*
* 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;
}
c++初试-文件流(9)
最新推荐文章于 2020-11-24 11:04:01 发布