sync.html 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5. <meta http-equiv="Content-Style-Type" content="text/css">
  6. <link rel="up" title="FatFs" href="../00index_e.html">
  7. <link rel="alternate" hreflang="ja" title="Japanese" href="../ja/sync.html">
  8. <link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
  9. <title>FatFs - f_sync</title>
  10. </head>
  11. <body>
  12. <div class="para func">
  13. <h2>f_sync</h2>
  14. <p>The f_sync function flushes the cached information of a writing file.</p>
  15. <pre>
  16. FRESULT f_sync (
  17. FIL* <span class="arg">fp</span> <span class="c">/* [IN] File object */</span>
  18. );
  19. </pre>
  20. </div>
  21. <div class="para arg">
  22. <h4>Parameter</h4>
  23. <dl class="par">
  24. <dt>fp</dt>
  25. <dd>Pointer to the open file object to be flushed.</dd>
  26. </dl>
  27. </div>
  28. <div class="para ret">
  29. <h4>Return Values</h4>
  30. <p>
  31. <a href="rc.html#ok">FR_OK</a>,
  32. <a href="rc.html#de">FR_DISK_ERR</a>,
  33. <a href="rc.html#ie">FR_INT_ERR</a>,
  34. <a href="rc.html#io">FR_INVALID_OBJECT</a>,
  35. <a href="rc.html#tm">FR_TIMEOUT</a>
  36. </p>
  37. </div>
  38. <div class="para desc">
  39. <h4>Description</h4>
  40. <p>The <tt>f_sync</tt> function performs the same process as <tt>f_close</tt> 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 <tt>f_sync</tt> function of periodic or immediataly after <tt>f_write</tt> function can minimize the risk of data loss due to a sudden blackout or an unintentional media removal. For more information, refer to <a href="appnote.html#critical">application note</a>.</p>
  41. <p>However there is no sense in <tt>f_sync</tt> function immediataly before <tt>f_close</tt> function because it performs <tt>f_sync</tt> function in it. In other words, the differnce between those functions is that the file object is invalidated or not.</p>
  42. </div>
  43. <div class="para comp">
  44. <h4>QuickInfo</h4>
  45. <p>Available when <tt>_FS_READONLY == 0</tt>.</p>
  46. </div>
  47. <div class="para ref">
  48. <h4>See Also</h4>
  49. <p><tt><a href="close.html">f_close</a></tt></p>
  50. </div>
  51. <p class="foot"><a href="../00index_e.html">Return</a></p>
  52. </body>
  53. </html>