Names specified here
Name Description Notes Source Availability
clearerr() Clear error flag on stream (·) <stdio.h> C89 C90 C95 C99 C11
EOF End-of-stream indicator M Headers C89 C90 C95 C99 C11
feof() Test for end of stream (·) <stdio.h> C89 C90 C95 C99 C11
ferror() Test for stream error (·) <stdio.h> C89 C90 C95 C99 C11
WEOF End-of-stream indicator H M Headers C95 C99 C11
WINT_MAX Maximum value of wint_t H M <stdint.h> C99 C11
WINT_MIN Minimum value of wint_t H M <stdint.h> C99 C11
wint_t Wide-character or error type H T Headers C95 C99 C11
#include <stdio.h>
int ferror(FILE *stream);
void clearerr(FILE *stream);
int feof(FILE *stream);

Every stream has an error indicator, initially clear. ferror returns non-zero if the error indicator of stream is set. clearerr and rewind clear the error indicator of stream.

Unless a stream is unlimited, reading from it will eventually reach its end. Every stream has an end-of-file indicator, which is set when attempting to read beyond the end of the stream. feof returns non-zero if the end-of-file indicator of stream is set. clearerr also clears the end-of-file indicator. Note that the EOF indicator is set only after attempting to read beyond the end, not merely when the end has been reached.

Byte-oriented functions like fgetc return an unsigned byte as an int so that they can also return a negative value to indicate end-of-file. Symbolically, this value is EOF, defined in <stdio.h> and <ctype.h>. Wide-oriented equivalents like fgetwc similarly return a type wint_t that can hold either a wchar_t or an end-of-file indicator, WEOF, defined in <wchar.h> and <wctype.h>. wint_t has the range WINT_MIN to WINT_MAX, defined in <stdint.h>.


CHaR
Sitemap Supported
Site format updated 2024-06-05T22:37:07.391+0000
Data updated 1970-01-01T00:00:00.000+0000
Page updated 2022-06-17T21:43:05.000+0000