三个流 ifstream (读) ofstream(写) fstream(读或写)
把一个文件复制到另一个文件
char hy;
ifstream fin("D: est.txt");
if(!fin)
{
cout<<"cannot open input file"<<endl;
}
cout<<"open "<<endl;
ofstream fout("D: est1.txt");
if(!fout)
{
cout<<"cannot open output file"<<endl;
}
cout<<"open "<<endl;
while(fin.get(hy))
{
cout<<hy<<endl;
fout.put(hy);
}