check and reset stream status

You're viewing an older version of this page (#3246). View the current version.

View versions (3)

NAME

<span class="Nm" id="clearerr">clearerr</span>, <span class="Nm" id="clearerr_unlocked">clearerr_unlocked</span>, <span class="Nm" id="feof">feof</span>, <span class="Nm" id="feof_unlocked">feof_unlocked</span>, <span class="Nm" id="ferror">ferror</span>, <span class="Nm" id="ferror_unlocked">ferror_unlocked</span>, <span class="Nm" id="fileno">fileno</span>, <span class="Nm" id="fileno_unlocked">fileno_unlocked</span>

INTERFACE

#include <stdio.h> void clearerr ( FILE *stream ) void clearerr_unlocked ( FILE *stream ) int feof ( FILE *stream ) int feof_unlocked ( FILE *stream ) int ferror ( FILE *stream ) int ferror_unlocked ( FILE *stream ) int fileno ( FILE *stream ) int fileno_unlocked ( FILE *stream )

DESCRIPTION

The function clearerr clears the end-of-file and error indicators for the stream pointed to by &#92;c stream. &#92;n &#92;n The function feof tests the end-of-file indicator for the stream pointed to by &#92;c stream, returning non-zero if it is set. The end-of-file indicator can only be cleared by the function clearerr . &#92;n &#92;n The function ferror tests the error indicator for the stream pointed to by &#92;c stream, returning non-zero if it is set. The error indicator can only be reset by the clearerr function. &#92;n &#92;n The function fileno examines the argument &#92;c stream and returns its integer descriptor. &#92;n &#92;n The clearerr_unlocked , feof_unlocked , ferror_unlocked , and fileno_unlocked functions are equivalent to clearerr , feof , ferror , and fileno respectively, except that the caller is responsible for locking the stream with reference:flockfile (3) before calling them. These functions may be used to avoid the overhead of locking the stream and to prevent races when multiple threads are operating on the same stream.

ERRORS

These functions should not fail and do not set the external variable <span class="Va">errno</span>.

SEE ALSO

reference:open (2) , reference:fdopen (3) , reference:flockfile (3) , reference:stdio (3)

STANDARDS

The functions clearerr , feof , and ferror conform to