home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / C / R_LA4_02.ZIP / READS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1987-12-30  |  494 b   |  19 lines

  1. /* READS.C - From page 437 of "Microsoft C Programming for      */
  2. /* the IBM" by Robert Lafore. Reads strings from a file,        */
  3. /* TEXTFILE.TXT, and displays them on screen.                   */
  4. /****************************************************************/
  5.  
  6. #include <stdio.h>
  7.  
  8. main()
  9. {
  10. FILE *fptr;
  11. char string[81];
  12.  
  13.    fptr = fopen("c:textfile.txt", "r");
  14.    while(fgets(string, 80, fptr) != NULL)   /*read string*/
  15.       printf("%s", string);
  16.    fclose(fptr);
  17. }
  18.  
  19.