]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - fatfs/doc/en/open.html
Import fatfs R0.12b
[z180-stamp.git] / fatfs / doc / en / open.html
index d61a7a4530d9af41f87ba49a0fae3ffec6343bd3..feade156543a81fd554deb6a4d17a58b69805dca 100644 (file)
@@ -27,20 +27,20 @@ FRESULT f_open (
 <h4>Parameters</h4>\r
 <dl class="par">\r
 <dt>fp</dt>\r
-<dd>Pointer to the blank file object structure to be created.</dd>\r
+<dd>Pointer to the blank file object structure.</dd>\r
 <dt>path</dt>\r
-<dd>Pointer to a null-terminated string that specifies the <a href="filename.html">file name</a> to open or create.</dd>\r
+<dd>Pointer to the null-terminated string that specifies the <a href="filename.html">file name</a> to open or create.</dd>\r
 <dt>mode</dt>\r
 <dd>Mode flags that specifies the type of access and open method for the file. It is specified by a combination of following flags.<br>\r
 <table class="lst">\r
-<tr><th>Value</th><th>Description</th></tr>\r
-<tr><td>FA_READ</td><td>Specifies read access to the object. Data can be read from the file. Combine with <tt>FA_WRITE</tt> for read-write access.</td></tr>\r
+<tr><th>Value</th><th>Meaning</th></tr>\r
+<tr><td>FA_READ</td><td>Specifies read access to the object. Data can be read from the file.</tr>\r
 <tr><td>FA_WRITE</td><td>Specifies write access to the object. Data can be written to the file. Combine with <tt>FA_READ</tt> for read-write access.</td></tr>\r
 <tr><td>FA_OPEN_EXISTING</td><td>Opens the file. The function fails if the file is not existing. (Default)</td></tr>\r
-<tr><td>FA_OPEN_ALWAYS</td><td>Opens the file if it is existing. If not, a new file is created.<br>\r
-To append data to the file, use <a href="lseek.html"><tt>f_lseek()</tt></a> function after file open in this method.</td></tr>\r
 <tr><td>FA_CREATE_NEW</td><td>Creates a new file. The function fails with <tt>FR_EXIST</tt> if the file is existing.</td></tr>\r
 <tr><td>FA_CREATE_ALWAYS</td><td>Creates a new file. If the file is existing, it will be truncated and overwritten.</td></tr>\r
+<tr><td>FA_OPEN_ALWAYS</td><td>Opens the file if it is existing. If not, a new file will be created.</td></tr>\r
+<tr><td>FA_OPEN_APPEND</td><td>Same as <tt>FA_OPEN_ALWAYS</tt> except read/write pointer is set end of the file.</td></tr>\r
 </table>\r
 </dd>\r
 </dl>\r
@@ -74,15 +74,15 @@ To append data to the file, use <a href="lseek.html"><tt>f_lseek()</tt></a> func
 \r
 <div class="para desc">\r
 <h4>Description</h4>\r
-<p>After <tt>f_open()</tt> function succeeded, the file object is valid. The file object is used for subsequent read/write functions to identify the file. To close an open file, use <a href="close.html"><tt>f_close()</tt></a> function. If the file is modified and not closed properly, the file data will be collapsed.</p>\r
-<p>If duplicated file open is needed, read <a href="appnote.html#dup">here</a> carefully. However duplicated open of a file with write mode flag is always prohibited.</p>\r
-<p>Before using any file function, a work area (file system object) must be registered to the logical drive with <a href="mount.html"><tt>f_mount()</tt></a> function. All API functions except for <a href="fdisk.html"><tt>f_fdisk()</tt></a> function can work after this procedure.</p>\r
+<p>Before using any file function, a work area (file system object) needs to be registered to the logical drive with <a href="mount.html"><tt>f_mount</tt></a> function. All API functions except for <tt>f_mkfs/f_fdisk</tt> function get ready to work after this procedure.</p>\r
+<p>After <tt>f_open</tt> function succeeded, the file object is valid. The file object is used for subsequent operations to the file to identify the file. Open file must be closed prior to power down, media removal or re-mount, or the file can be collapsed. To close an open file, use <a href="close.html"><tt>f_close</tt></a> function.</p>\r
+<p>If duplicated file open is needed, read <a href="appnote.html#dup">here</a> carefully. However duplicated open of a file with any write mode flag is always prohibited.</p>\r
 </div>\r
 \r
 \r
 <div class="para comp">\r
 <h4>QuickInfo</h4>\r
-<p>Always available. The mode flags, <tt>FA_WRITE, FA_CREATE_ALWAYS, FA_CREATE_NEW and FA_OPEN_ALWAYS</tt>, are not available when <tt>_FS_READONLY == 1</tt>.</p>\r
+<p>Always available. Only <tt>FA_READ</tt> and <tt>FA_OPEN_EXISTING</tt> are supported when <tt>_FS_READONLY == 1</tt>.</p>\r
 </div>\r
 \r
 \r
@@ -134,11 +134,11 @@ int main (void)
     f_mount(&amp;fs[1], "1:", 0);\r
 \r
     <span class="c">/* Open source file on the drive 1 */</span>\r
-    fr = f_open(&amp;fsrc, "1:file.bin", FA_OPEN_EXISTING | FA_READ);\r
+    fr = f_open(&amp;fsrc, "1:file.bin", FA_READ);\r
     if (fr) return (int)fr;\r
 \r
     <span class="c">/* Create destination file on the drive 0 */</span>\r
-    fr = f_open(&amp;fdst, "0:file.bin", FA_CREATE_ALWAYS | FA_WRITE);\r
+    fr = f_open(&amp;fdst, "0:file.bin", FA_WRITE | FA_CREATE_ALWAYS);\r
     if (fr) return (int)fr;\r
 \r
     <span class="c">/* Copy source to destination */</span>\r