clearerr() Library Function in C with Examples

The library function clearerr() in C programming language is used to reset stream error and end-of-file indicators to 0.

clearerr() Syntax

The declaration syntax for clearerr() function is:


void clearerr(*stream);

clearerr() Working

clearerr() function in C resets the named stream's error and sets end-of-file indicators to 0.

Once the error indicator is set, any stream operations return error status.

Any stream operations continue to return error status until a function call is made to clearerr() or rewind().

The end-of-file indicator is reset with each input operation.

As return type in syntax declaration is void, function clearerr() does not return anything. In other words return value of library function clearerr() is None.