FERROR(3S)
NAME
ferror, feof, clearerr − stream status inquiries
SYNOPSIS
#include <stdio.h>
int ferror (stream)
FILE
∗stream;
int feof (stream)
FILE
∗stream;
void clearerr (stream)
FILE
∗stream;
DESCRIPTION
Ferror returns non-zero when an I/O error has previously occurred reading from or writing to the named stream, otherwise zero. Unless cleared by clearerr, or unless the specific stdio routine so indicates, the error indication lasts until the stream is closed.
Feof returns non-zero when EOF has previously been detected reading the named input stream, otherwise zero.
Clearerr resets the error indicator and EOF indicator to zero on the named stream.
WARNINGS
All these routines are implemented as both library functions and macros. The macro versions, which are used by default, are defined in <stdio.h>. To obtain the library function either use a #undef to remove the macro definition or, if compiling in ANSI-C mode, enclose the function name in parenthesis or use the function address. For following example illustrates each of these methods :
#include <stdio.h>
#undef ferror
...
main()
{
int (*find_error()) ();
...
return_val=ferror(fd);
...
return_val=(feof)(fd1);
...
find_error = feof;
};
SEE ALSO
STANDARDS CONFORMANCE
ferror: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C
clearerr: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C
feof: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C
Hewlett-Packard Company — HP-UX Release 7.0: Sept 1989