File Error Functions
The file module has functions get and clear a file’s error status that are almost exact equivalents to POSIX API functions (see Listing - File Module Function and Listing - POSIX API Equivalent); the primary difference is the advantage of valuable return error codes to the application.
Listing - File Module Function
void FSFile_ClrErr(FS_FILE *p_file, FS_ERR *p_err); CPU_BOOLEAN FSFile_IsErr (FS_FILE *p_file, FS_ERR *p_err); CPU_BOOLEAN FSFile_IsEOF (FS_FILE *p_file, FS_ERR *p_err);
Listing - POSIX API Equivalent
void fs_clearerr (FS_FILE *stream); int fs_ferror (FS_FILE *stream); int fs_feof (FS_FILE *stream);
For more information about this functionality, see Diagnosing a File Error - POSIX.