#include<iostream>
#include<fstream>
using namespace std;
int main(void)
{
cout<<" "<<"文件复制程序"<<endl;
cout<<"输入源文件名及路径,如c:\\example\\temp.txt"<<endl;
int const FILE_SIZE=40;
char SourceFile[FILE_SIZE];
cin>>SourceFile;
cout<<"输入目标文件及路径"<<endl;
char TargetFile[FILE_SIZE];
cin>>TargetFile;
ofstream output;
ifstream input;
output.open(TargetFile);
input.open(SourceFile);
if(input.fail())
{
cout<<"文件"<<SourceFile<<"不存在"<<endl;
cout<<"程序退出"<<endl;
return 0;
}
while(!input.eof())
{
output.put(input.get());
}
input.close();
output.close();
cout<<"复制完成"<<endl;
return 0;
}