#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
ofstream f;
f.open("test.txt",ios::out);
f << "aaaaaa" << endl;
ifstream f;
f.open("test.txt",ios::in);
string buf;
while (getline(f, buf)) {
cout << buf << endl;
}
f.close();
system("pause");
return 0;
}
标签:文件,include,buf,读写,ios,c++,test,txt,open From: https://www.cnblogs.com/chentianyu/p/16784530.html