Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>feof</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
feof

Usage

   #include <stdio.h>
   int feof(FILE *fp);

   ANSI

Description

   feof determines if the stream fp is at the end of file. After the EOF
   indicator is set no further read operations are allowed.

Example 

   #include <stdio.h>
   #include <stdlib.h>

   #define BUFSIZE 128
   char buffer[BUFSIZE];

   int main()
   {
       FILE *fp;
       fp = fopen ("file.dat", "r");
           {
               while ( !feof(fp) )
                   fgets(buffer, BUFSIZE, fp);
           }
       printf("Done reading file, EOF found\n",buffer);
       return EXIT_SUCCESS;
   }

Return Value

   Non-zero (EOF flag set) if current position is end. No read operations
   are allowed after the flag is set. The flag is cleared if rewind, fseek
   or file is closed. 0 if the flag is clear.

See Also

   clearerr, ferror



See Also: clearerr ferror

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson