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>ferror</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
ferror

Usage

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

   ANSI

Description

   ferror checks the error flag on the stream fp. The error flag remains set
   until a clearerr, rewind or fseek is issued or the stream is closed. No
   read or write operations can be carried out until this flag is cleared.

Example 

   #include <stdio.h>

   #include <stdlib.h>

   int main()
   {
       int c;
       if ( (c = fgetc(stdin)) == EOF)
           if (ferror(stdin))
               {
                   fprintf(stderr,"Read error\n");
                   clearerr(stdin);
                   return EXIT_FAILURE;
               }
       printf("No error\n");
       return EXIT_SUCCESS;
   }

Return Value

   Returns non-zero if the error flag is set, otherwise it returns a zero.

See Also

   clearerr, feof



See Also: clearerr feof

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