1.2.7.4.15 SYS_FS_Error Function
C
SYS_FS_ERROR SYS_FS_Error( void );
Summary
Returns the last error.
Description
When a file system operation fails, the application can know the reason of failure by calling the SYS_FS_Error. This function only reports the errors which are not file (or file handle) specific. For example, for functions such as SYS_FS_Mount and SYS_FS_FileOpen, which do not take handle, any errors happening inside such function calls could be reported using SYS_FS_Error function.
Even for functions, which take handle as its input parameters, the SYS_FS_Error function can be used to report the type of error for cases where the passed handle itself is invalid.
Precondition
This function has to be called immediately after a failure is observed while doing a file operation.
Any subsequent failure will overwrite the cause of previous failure.
Parameters
None.
Returns
Error code of type SYS_FS_ERROR.
Example
SYS_FS_HANDLE fileHandle;
SYS_FS_ERROR err;
fileHandle = SYS_FS_FileOpen("/mnt/myDrive/FILE.txt", (SYS_FS_FILE_OPEN_READ));
if(fileHandle == SYS_FS_HANDLE_INVALID)
{
// If failure, now know the specific reason for failure
err = SYS_FS_Error();
}
Remarks
None.