ferror

Tests the error indicator for a stream (function or macro)

Local Servers:nonblocking
Remote Servers:nonblocking
Classification:ANSI
Platform:NLM
Service:Stream I/O

Syntax

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

Parameters

fp
(IN) Points to the file to be tested.

Return Values

ferror returns nonzero if the error indicator is set for fp.

Remarks

The ferror function or macro tests the error indicator for the file pointed to by fp.

See Also

clearerr, feof, strerror (NDK: NLM Development Concepts, Tools, and Functions)

ferror Example

  #include <stdio.h>  
   
  main ()  
  {  
     FILE    *fp;  
     int     c;  
     c = fgetc (fp);  
     if (ferror (fp) )  
     {                       /* if end-of-file */  
        fclose  (fp);        /* close the file */  
        c = EOF;  
     }  
  }