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

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

   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>
   main()
   {
   int c;
        if( (c = fgetc(stdin)) == EOF)
        if(ferror(stdin))
        {
             fprintf(stderr,"Read error\n");
             clearerr(stdin);
        }
        printf("No error\n");
   }

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


See Also: clearerr feof

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