home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource4 / 258_01 / printdat.c < prev    next >
Text File  |  1988-03-30  |  640b  |  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.