ferror


ferror

Tests whether a file access error has occurred

 #include <stdio.h> int ferror ( FILE *fp  ); 

The ferror( ) functionoften implemented as a macrotests whether an error has been registered in reading or writing a given file.

ferror( )'s argument is a FILE pointer. One attribute of the file or stream referenced by this pointer is an error flag which indicates that an error has occurred during a read or write operation. The ferror( ) function or macro tests the error flag and returns a nonzero value if the flag is set. If not, ferror( ) returns 0.

Example

See the examples for clearerr( ) and fclose( ) in this chapter.

See Also

rewind( ), clearerr( ), feof( )



C(c) In a Nutshell
C in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596006977
EAN: 2147483647
Year: 2006
Pages: 473

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net