home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 September / Simtel20_Sept92.cdr / msdos / turbo_c / trbocsrc.arc / READCHAR.C < prev    next >
C/C++ Source or Header  |  1988-02-01  |  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.