clearerr(), feof(), ferror(), fileno() - check and reset stream status
#include <stdio.h>
void clearerr (FILE *stream)
int feof (FILE *stream)
int ferror (FILE *stream)
int fileno (FILE *stream)
The function clearerr(3) clears the end-of-file and error indicators for the stream pointed to by stream.
The function feof(3) tests the end-of-file indicator for the stream pointed to by stream, returning non-zero if it is set. The end-of-file indicator can only be cleared by the function clearerr(3).
The function ferror(3) tests the error indicator for the stream pointed to by stream, returning non-zero if it is set. The error indicator can only be reset by the clearerr(3) function.
The function fileno(3) examines the argument stream and returns its integer descriptor.
These functions should not fail and do not set the external variable errno
open(2)