X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/70702af1370e44e32fb2c3c507e4759a187b4fe5..289f6a146c0b2087607d8d8659531ea90142779a:/fatfs/documents/doc/sync.html?ds=sidebyside diff --git a/fatfs/documents/doc/sync.html b/fatfs/documents/doc/sync.html new file mode 100644 index 0000000..a0317d6 --- /dev/null +++ b/fatfs/documents/doc/sync.html @@ -0,0 +1,65 @@ + + + + + + + + +FatFs - f_sync + + + + +
+

f_sync

+

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

+
+FRESULT f_sync (
+  FIL* fp     /* [IN] File object */
+);
+
+
+ +
+

Parameter

+
+
fp
+
Pointer to the open file object to be flushed.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_INVALID_OBJECT, +FR_TIMEOUT +

+
+ + +
+

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 the applications that open files for a long time in write mode, such as data logger. Performing f_sync function of periodic or immediataly after f_write function can minimize the risk of data loss due to a sudden blackout or an unintentional media removal. For more information, refer to application note.

+

However there is no sense in f_sync function immediataly before f_close function because it performs f_sync function in it. In other words, the differnce between those functions is that the file object is invalidated or not.

+
+ + +
+

QuickInfo

+

Available when FF_FS_READONLY == 0.

+
+ + +
+

See Also

+

f_close, Critical section

+
+ +

Return

+ +