The f_sync flushes the cached information of the wriiting file.
FRESULT f_sync ( FIL* FileObject // Pointer to the file object structure );
The f_sync() writes back the cached information of the file being written. This performs the same function as f_close() but the file is left opened and can continue file read/write operations to the file. This is suitable for applications that open files for a long time in writing mode, such as data logger. Performing f_sync() of periodic or immediataly after f_write() can minimize risk of data loss due to sudden blackout or unintentional disk removal. This function is not supported in read-only configuration.