/*PROGRAM TO COPY ONE FILE INTO ANOTHER FILE*/
#include<fstream.h>
#include<iostream.h>
#include<iomanip.h>
#include<stdlib.h>
#include<conio.h>
void main()
{
clrscr();
ofstream outfile;
ifstream infile;
char fname1[10],fname2[10];
char ch;
cout<<“Enter a file name to be copied ?”<<endl;
cin>>fname1;
cout<<“New file name ?”<<endl;
cin>>fname2;
infile.open(fname1);
if(infile.fail())
{
cerr<<“No such a file exists “<<endl;
exit(1);
}
outfile.open(fname2);
if(outfile.fail())
{
cerr<<“Unable to create a file “<<endl;
exit(1);
}
while(! infile.eof())
{
ch=(char)infile.get();
cout<<ch;
}
infile.close();
outfile.close();
getch();
}