//把cipy.txt的文件内容拷贝到test.txt里
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ofstream outfile("test.txt");
ifstream infile("copy.txt");
if(!infile) //测试是否成功打开一个文件
{
cerr<<"Err:打开copy.txt文件失败!/n";
return -1;
}
string stri;
while(infile >>stri)
outfile<<stri<<' ';
cout<<"文件内容复制成功!"<<endl;
return 0;
}