clearerr

Clears the end-of-file and error indicators for a stream (function or macro)

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

Syntax

  #include <stdio.h>  
   
  void clearerr  (  
     FILE   *fp);
  

Parameters

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

Remarks

The clearerr function or macro clears the end-of-file and error indicators for the file pointed to by fp. These indicators are cleared only when the file is opened or by an explicit call to the clearerr or rewind functions.

See Also

feof, ferror, perror (NDK: NLM Development Concepts, Tools, and Functions)

clearerr Example

  #include <stdio.h> 
    
  main ()  
  {  
     FILE   *fp;  
     int     c;  
     fp=fopen("testfile", "wt");  
     if (ferror (fp) )  
     {                                 /* If error,*/  
        clearerr (fp);                 /* clear the error */  
        fputc (c, fp);                 /* and retry it */  
     }  
  }