Please check the manual page ferror(3).