Skip to content

Latest commit

 

History

History
50 lines (34 loc) · 869 Bytes

160_clearerr.asciidoc

File metadata and controls

50 lines (34 loc) · 869 Bytes

clearerr

NAME

clearerr - Reset error indicators.

SYNOPSIS
#include <stdio.h>

void clearerr( FILE *stream );
DESCRIPTION

The function clearerr clears the end-of-file (EOF) and error indicators for the stream pointed to by stream.

RETURN VALUE

None.

SEE ALSO

feof, ferror, fwrite

EXAMPLE
link:src/clearerr.c[role=include]

This program opens a existing file in read-only mode thus causing an I/O error. That error is cleared using clearerr so a second error checking returns false.

OUTPUT
$ gcc -Wall clearerr.c
$ ./a.out test
Error opening file: No such file or directory
$ touch test
$ ./a.out test
Error Writing to test.
No errors reading test.