This indicator is generaly set by a previous operation on the stream that failed.
Parameters
- stream
- Pointer to a FILE object that identifies the stream.
Return Value
If the error indicator associated with the stream was set, the function returns a nonzero value.Otherwise, it returns a zero value.
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
This program opens an existing file called myfile.txt in read-only mode but tries to write a character to it, generating an error that is detected by ferror.
Output:
Error Writing to myfile.txt
See also
| feof | Check End-of-File indicator (function) |
| clearerr | Clear error indicators (function) |
| perror | Print error message (function) |
