## f_sync

The f_sync function flushes the cached information of a writing file.

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

#### Parameter

FileObject
  Pointer to the open file object to be flushed.

#### Return Values

FR_OK (0)
  The function succeeded.
FR_RW_ERROR
  The function failed due to a disk error or an internal error.
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_sync function performs the same process as f_close function but the file is left opened and can continue read/write/seek 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 a sudden blackout or an unintentional disk removal. This function is not supported in read-only configuration.

#### References

`f_close`

Return