#include <fstream.h>
void main(){
ifstream fin("d://try.txt",ios::nocreate);//打开文件不存在返回error
ofstream fout("d://out.txt",ios::app);//打开文件不存在创建,存在追加
if(!fin){
cout<<"File open error!/n";
return ;
}
if(!fout){
cout<<"File create error!/n";
return ;
}
char c[80];
while(!fin.eof()){
fin.read(c,80); //从输入流中读出字符存放到c数组中
cout.write(c,fin.gcount());
fout.write(c,fin.gcount());//将数组中存放的实际字符个数写入到输出流中
}
fin.close();
fout.close();
}