1.2.7.4.7 SYS_FS_FileClose Function

C

SYS_FS_RESULT SYS_FS_FileClose
(
    SYS_FS_HANDLE handle
);

Summary

Closes a file.

Description

This function closes an opened file. Before closing the file it performs a force sync to write any pending data to the file.

Precondition

A valid file handle must be obtained before closing a file.

Parameters

ParamDescription
handleA valid handle, which was obtained while opening the file.

Returns

SYS_FS_RES_SUCCESS - File close operation was successful.

SYS_FS_RES_FAILURE - File close operation failed. The reason for the failure can be retrieved with SYS_FS_Error or SYS_FS_FileError.

Example

SYS_FS_HANDLE fileHandle;
fileHandle = SYS_FS_FileOpen("/mnt/myDrive/FILE.txt", (SYS_FS_FILE_OPEN_READ));

if(fileHandle != SYS_FS_HANDLE_INVALID)
{
    // File open is successful
}

SYS_FS_FileClose(fileHandle);

Remarks

None.