home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_10 / 8n10094a < prev    next >
Text File  |  1990-07-23  |  429b  |  19 lines

  1.  
  2. #include <stdio.h>
  3. main()
  4. {
  5. /* using the returned values in conditional statements */
  6. FILE *fp;
  7. char buff[181];
  8. int more_data;
  9.  
  10. if ((fp = fopen("MYFILE.DAT","r")) == NULL)
  11.         printf("file not found\n");
  12. else {
  13.         printf("file found\n\n");
  14.         /* loop and print until we reach the end of file */
  15.         while ((more_data = fgets(buff, 180, fp)) != NULL)
  16.                 printf(buff);
  17.         }
  18. }
  19.