65,187
社区成员




#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
fstream file("a.txt",ios::out|ios::in|ios::trunc);
file << "Data of test!" << endl;
string str;
file >> str;
cout << "str=" << str << endl;
return 0;
}
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
fstream file("a.txt", ios::out | ios::in | ios::trunc);
file << "Data of test!" << endl;
fstream read("a.txt");
string str;
read >> str;
cout << "str=" << str << endl;
return 0;
}