clearerr
raw OCR
Resets error indication.
Defined in header <stdio.h>
Syntax
#include <stdio.h>
void clearerr(FILE *stream);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ | ■ | ■ |
Remarks
clearerr resets the named stream's error and end-of-file indicators to 0. Once the error indicator is set, stream operations continue to retui-n error status until a call is made to clearerr or rewind.
The end-of-file indicator is reset with each input operation.
Return value
None.
See also
Example
#include <stdio.h>
int main(void)
FILE *fp;
char ch;
/* open a file for writing */
fp = fopen("DUMMY.FIL", "w");
/* force an error condition by attempting to read */
ch = fgetc(fp);
printf("%c\n",ch);
if (ferror(fp)) {
/* display an error message */
printf("Error reading from DUMMY.FIL\n") ;
/* reset the error and EOF indicators */
clearerr(fp);
}
fclose(fp);
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/stdio.h/clearerr/
· short form /3.1/clearerr/