Error Handling Functions
The clearerr function
#include <stdio.h>
void clearerr(FILE *stream);
The clearerr function clears the end-of-file and error indicators for the stream pointed to by stream.
The feof function
#include <stdio.h>
int feof(FILE *stream);
The feof function tests the end-of-file indicator for the stream pointed to by stream and returns nonzero if and only if the end-of-file indicator is set for stream, otherwise it returns zero.
The ferror function
#include <stdio.h>
int ferror(FILE *stream);
The ferror function tests the error indicator for the stream pointed to by stream and returns nonzero if and only if the error indicator is set for stream, otherwise it returns zero.
The perror function
#include <stdio.h>
void perror(const char *s);
The perror function maps the error number in the integer expression errno to an error message. It writes a sequence of characters to the standard error stream thus: first, if s is not a null pointer and the character pointed to by s is not the null character, the string pointed to by s followed by a colon (:) and a space; then an appropriate error message string followed by a new-line character. The contents of the error message are the same as those returned by the strerror function with the argument errno, which are implementation-defined.
All text is available under the terms of the GNU Free Documentation License
Source : Wikibooks |