f_close

The f_close function closes an open file.

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

Parameter

FileObject
Pointer to the open file object structure to be closed.

Return Values

FR_OK (0)
The file object has been closed successfuly.
FR_RW_ERROR
Any error has occured in low level disk I/O.
FR_NOT_READY
The disk drive cannot work due to no medium in the drive or any other reason.
FR_INVALID_OBJECT
The file object is invalid.

Description

The f_close function closes an open file object. If any data has been written to the file, the cached information of the file is written back to the disk. After the function succeeded, the file object is no longer valid and it can be discarded.

References

f_open, f_read, f_write, f_sync, FIL, FATFS

Return