Tuesday, 28 April 2020

Write a program to copy the contents of one file to another.

#include <fstream.h>
void main( )
{
char cource[ 67 ],
target[ 67 ];
char ch;
cout << endl << "Enter source filename";
cin >> source;
cout << endl << "Enter target filename";
cin >> target;
ifstream infile ( source );
ofstream outfile ( target );
while( infile )
{
infile.get( ch );
outfile.put( ch );
}
}

No comments:

Post a Comment