# include // // Program 16.3, Stephen Kochan, Programming in C. // int main ( void ); int main ( void ) { char inName[64], outName[64]; FILE *in, *out; int c; printf ( "Enter name of file to be copied: " ); scanf ( "%63s", inName ); printf ( "Enter name of output file: " ); scanf ( "%63s", outName ); in = fopen ( inName, "r" ); if ( in == NULL ) { printf ( "Can't open %s for reading.\n", inName ); return 1; } out = fopen ( outName, "w" ); if ( out == NULL ) { printf ( "Can't open %s for writing.\n", outName ); return 2; } while ( 1 ) { c = getc ( in ); if ( c == EOF ) { break; } putc ( c, out ); } fclose ( in ); fclose ( out ); printf ( "File has been copied.\n" ); return 0; }