fatfs v0.06 Apr 01, 2008:

- Added f_forward(). (Tiny-FatFs)
- Added string functions: fputc(), fputs(), fprintf() and fgets().
- Improved performance of f_lseek() on move to the same or following cluster.
This commit is contained in:
savelij13 committed 2025-09-11 09:17:24 +03:00
1 parent e400c8c902
commit b94c8f3bf3
72 files changed
+1804 -536

No files matched your search

+8 -8
View File
@@ -81,7 +81,7 @@ FRESULT f_open (
<div class="para">
<h4>Description</h4>
<p>The created file object is used for subsequent calls to refer to the file. When close an open file object, use <a href="close.html">f_close</a> function. If modified file is not closed correctly, the file will be collapsed.</p>
<p>The created file object is used for subsequent calls to refer to the file. When close an open file object, use <a href="close.html">f_close</a> function. If modified file is not closed correctly, the file may be collapsed.</p>
<p>Before using any file function, a work area (file system object) must be given to the logical drive with <a href="mount.html">f_mount</a> function. All file functions can work after this procedure.</p>
<p>The mode flags, <tt>FA_WRITE, FA_CREATE_ALWAYS, FA_CREATE_NEW, FA_OPEN_ALWAYS</tt>, are not supported in read-only configuration.</p>
</div>
@@ -100,27 +100,27 @@ void main ()
// Register a work area for logical drive 0
f_mount(0, &fs);
f_mount(0, &amp;fs);
// Open source file
res = f_open(&fsrc, "srcfile.dat", FA_OPEN_EXISTING | FA_READ);
res = f_open(&amp;fsrc, "srcfile.dat", FA_OPEN_EXISTING | FA_READ);
if (res) die(res);
// Create destination file
res = f_open(&fdst, "dstfile.dat", FA_CREATE_ALWAYS | FA_WRITE);
res = f_open(&amp;fdst, "dstfile.dat", FA_CREATE_ALWAYS | FA_WRITE);
if (res) die(res);
// Copy source to destination
for (;;) {
res = f_read(&fsrc, buffer, sizeof(buffer), &br);
res = f_read(&amp;fsrc, buffer, sizeof(buffer), &amp;br);
if (res || br == 0) break; // error or eof
res = f_write(&fdst, buffer, br, &bw);
res = f_write(&amp;fdst, buffer, br, &amp;bw);
if (res || bw &lt; br) break; // error or disk full
}
// Close all files
f_close(&fsrc);
f_close(&fdst);
f_close(&amp;fsrc);
f_close(&amp;fdst);
// Unregister a work area before discard it
f_mount(0, NULL);