home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1995 December / SOFM_Dec1995.bin / pc / dos / gi / ctutor / readchar.c < prev    next >
C/C++ Source or Header  |  1995-10-31  |  480b  |  20 lines

  1.                                          /* Chapter 10 - Program 3 */
  2. #include "stdio.h"
  3.  
  4. main()
  5. {
  6. FILE *funny;
  7. char c;
  8.  
  9.    funny = fopen("TENLINES.TXT","r");
  10.  
  11.    if (funny == NULL) printf("File doesn't exist\n");
  12.    else {
  13.       do {
  14.          c = getc(funny);    /* get one character from the file */
  15.          putchar(c);         /* display it on the monitor       */
  16.       } while (c != EOF);    /* repeat until EOF (end of file)  */
  17.    }
  18.    fclose(funny);
  19. }
  20.