test the error indicator for a stream
#include <stdio.h> int ferror( FILE *fp );
The ferror() function tests the error indicator for the stream pointed to by fp.
clearerr(), feof(), perror(), strerror()
#include <stdio.h> void main() { FILE *fp; int c; fp = fopen( "file", "r" ); if( fp != NULL ) { c = fgetc( fp ); if( ferror( fp ) ) { printf( "Error reading file\n" ); } } fclose( fp ); }
ANSI
All (except DOS/PM)