feof, ferror, clearerr, fileno
Purpose
Checks the status of a stream.
Library
Standard I/O Library (libc.a)
Syntax
#include <stdio.h>
int feof (stream) void clearerr (stream)
FILE *stream; FILE *stream;
int ferror (stream) int fileno (stream)
FILE *stream; FILE *stream;
Description
These macros inquire about the status of a stream.
The feof macro inquires about end-of-file. If EOF has
previously been detected reading the input stream speci-
fied by the stream parameter, a nonzero value is
returned. Otherwise, a value of 0 is returned.
The ferror macro inquires about input/output errors. If
an I/O error has previously occurred when reading from or
writing to the stream specified by the stream parameter,
a nonzero value is returned. Otherwise, a value of 0 is
returned.
The clearerr macro resets the error indicator and the EOF
indicator to 0 for the stream specified by the stream
parameter.
The fileno macro returns the integer file descriptor
associated with the input pointed to by the stream param-
eter.
Note: Since these routines are implemented as macros,
they cannot be declared or redeclared.
Related Information
In this book: "open," "fopen, freopen, fdopen," and
"standard i/o library."