home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / ctutor2.zip / PRINTDAT.C < prev    next >
Text File  |  1989-11-10  |  762b  |  32 lines

  1.                                         /* Chapter 10 - Program 8 */
  2. #include "stdio.h"
  3.  
  4. void 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.  
  24.  
  25.  
  26. /* Result of execution
  27.  
  28. (The file named TENLINES.TXT is listed
  29.             on the printer, and it is listed on the monitor.)
  30.  
  31. */
  32.