在此mark一下,免得下次再找,蛮详细
http://panpan.blog.51cto.com/489034/101625
int main()
{
ifstream f1;//读的方式打开文件
ofstream f2;//写的方式打开文件
f1.open("F:\\a.txt");
f2.open("F:\\b.txt");
char s[100]="";
while(f1)
{
f1.getline(s,100);
f2.write(s,strlen(s));
}
cout<<"赋值文件成功!";
f1.close();
f2.close();
return 0;
}