在编译后的文件目录下放置一个叫"test.txt"的文件,然后运行看看是什么效果!
#include
<
fstream
>
using namespace std;
int main() ... {
ifstream in("test.txt");
ofstream out("testout.txt");
for(string str; getline(in,str);)
out<<str+"~~copy~~"<<endl;
}
using namespace std;
int main() ... {
ifstream in("test.txt");
ofstream out("testout.txt");
for(string str; getline(in,str);)
out<<str+"~~copy~~"<<endl;
}