home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / GENCSRC.ZIP / PRINTDAT.C < prev    next >
C/C++ Source or Header  |  1987-11-21  |  615b  |  23 lines

  1.                                         /* Chapter 10 - Program 8 */
  2. #include "stdio.h"
  3.  
  4. main()
  5. {
  6. FILE *funny,*printer;
  7. char c;
  8.  
  9.    funny = fopen("TENLINES.TXT","r"); /* open input file     */
  10.    printer = fopen("PRN","w");        /* open printer file   */
  11.  
  12.    do {
  13.       c = getc(funny);    /* get one character from the file */
  14.       if (c != EOF) {
  15.          putchar(c);      /* display it on the monitor       */
  16.          putc(c,printer); /* print the character             */
  17.       }
  18.    } while (c != EOF);    /* repeat until EOF (end of file)  */
  19.  
  20.    fclose(funny);
  21.    fclose(printer);
  22. }
  23.