文件的拷贝
我想把input里的内容拷贝到outputl,下面的程序不能够实现,请指教
#include "iostream.h"
#include <fstream.h>
#include <string.h>
int main()
{
ofstream outfile("output.txt");
ifstream infile("input.txt");
if(!infile)
{
cerr<<"Error:Unable to open the input file"<<endl;
return -1;
}
if(!outfile)
{
cerr<<"Error:Unable to open the output file"<<endl;
return -2;
}
char word;
while(infile>>word)
cout<< outfile <<word;
return 0;