Tests for stream input/output file error state.
If file is in error state: Nonzero
The ferror function tests whether the stream input/output file indicated by file pointer fp is in the error state.
The ferror function tests the error indicator for the specified stream input/output file, and if the indicator is set, returns nonzero to show that the file is in the error state. If the error indicator is not set, the ferror function returns zero to show that the file is not in the error state.