#include <iostream>
#include <fstream>
using namespace std;
int main( int argc, char *argv[] )
{
if ( argc != 3 )
cout << "Usage: copy infile outfile" << endl;
else {
ifstream inFile( argv[ 1 ], ios::in );
if ( !inFile )
cout << argv[ 1 ] << " could not be opened" << endl;
ofstream outFile( argv[ 2 ], ios::out );
if ( !outFile )
cout << argv[ 2 ] << " could not be opened" << endl;
while ( !inFile.eof() )
outFile.put( static_cast< char >( inFile.get() ) );
}
return 0;
}
|