#include #include #include int main( int argc, char *argv[] ) { char ch; if ( argc != 3 ) { cerr << "copyfile-args fromfile destfile\n"; exit( 1 ); } ifstream fin( argv[ 1 ] ); ofstream fout( argv[ 2 ] ); if ( ! fin || ! fout ) { cerr << "Problem opening files\n"; exit( 2 ); } // The following skips white space: // while ( fin >> ch ) // fout << ch; while ( fin.get( ch ) ) fout.put( ch ); }