f_close

Function f_close closes a file.

FRESULT f_close (
  FIL* FileObject     // Pointer to the file object structure
);

Parameter

FileObject
Pointer to the file object structure to be closed.

Return Values

FR_OK (0)
The file has been closed successfuly.
FR_RW_ERROR
Any error occured in low level disk I/O.
FR_INCORRECT_DISK_CHANGE
Incorrect disk removal/change occured.
FR_NOT_ENABLED
FatFs module is not enabled.

Description

Function f_close closes a file. If any data has been written, the cached information of the file is written back to the disk. When the function succeeded, the file object is no longer valid and structure can be discarded.

References

f_open, f_read, f_write, f_sync, FIL, FATFS

Return