home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
progm
/
ctutor2.zip
/
ANSWERS
/
CH10_1.C
< prev
next >
Wrap
Text File
|
1989-11-10
|
705b
|
39 lines
#include "stdio.h"
main()
{
FILE *infile, *outfile, *printer;
char c, infilename[25], outfilename[25];
printf("Enter input file name ----> ");
scanf("%s",infilename);
infile = fopen(infilename,"r");
printf("Enter output file name ---> ");
scanf("%s",outfilename);
outfile = fopen(outfilename,"w");
printer = fopen("PRN","w");
do {
c = getc(infile);
if (c != EOF) {
putchar(c);
putc(c,outfile);
putc(c,printer);
}
} while (c != EOF);
fclose(printer);
fclose(infile);
fclose(outfile);
}
/* Result of execution
(This program writes to the printer, a file, and the monitor.)
*/