f_sync

The f_sync flushes the cached information of the wriiting file.

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

Parameters

FileObject
Pointer to the file object to be flushed.

Return Values

FR_OK
The function succeeded.
FR_RW_ERROR
Any error occured in low level disk I/O.
FR_INCORRECT_DISK_CHANGE
Incorrect disk removal, such as a medium change during any file opend, has been occured.
FR_NOT_ENABLED
FatFs module has not been enabled.

Description

The f_sync writes back the cached information of a file being written into the disk. This is the same function as f_close but the file is left opened and can continue the file access. This is suitable for an application of data logger that opens a file for long time in writing mode. The f_sync of periodic or immediataly after f_wriete can minimize the lost data due to an unintentional black out or disk removal. This function is not supported in read-only configuration.

References

f_close

Return