fatfs v0.07a Apr 14, 2009:
- Separated out OS dependent code on reentrant cfg. - Added multiple sector size support.
This commit is contained in:
1 parent
b94c8f3bf3
commit
3bb1c09ac4
88 files changed
+33446
-3894
No files matched your search
+24
-6
@@ -16,8 +16,8 @@
|
||||
|
||||
<pre>
|
||||
FRESULT f_lseek (
|
||||
FIL* <em>FileObject</em>, /* Pointer to the file object structure *
|
||||
DWORD <em>Offset</em> /* File offset in unit of byte *
|
||||
FIL* <em>FileObject</em>, /* Pointer to the file object structure */
|
||||
DWORD <em>Offset</em> /* File offset in unit of byte */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
@@ -38,8 +38,10 @@ FRESULT f_lseek (
|
||||
<dl class="ret">
|
||||
<dt>FR_OK (0)</dt>
|
||||
<dd>The function succeeded.</dd>
|
||||
<dt>FR_RW_ERROR</dt>
|
||||
<dd>The function failed due to a disk error or an internal error.</dd>
|
||||
<dt>FR_DISK_ERR</dt>
|
||||
<dd>The function failed due to an error in the disk function.</dd>
|
||||
<dt>FR_INT_ERR</dt>
|
||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
||||
<dt>FR_NOT_READY</dt>
|
||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
||||
<dt>FR_INVALID_OBJECT</dt>
|
||||
@@ -50,11 +52,10 @@ FRESULT f_lseek (
|
||||
|
||||
<div class="para">
|
||||
<h4>Description</h4>
|
||||
<p>The f_lseek function moves the file R/W pointer of an open file. The offset can be specified in only origin from top of the file. When an offset above the file size is specified in write mode, the file size is extended to the offset and the data in the extended area is undefined. This is suitable to create a large file quickly, for fast write operation without cluster allocation delay. After the f_lseek function succeeded, member fptr in the file object should be checked in order to make sure the R/W pointer has been moved correctry. In case of fptr is less than expected value, any of the followings has been occured.</p>
|
||||
<p>The f_lseek function moves the file R/W pointer of an open file. The offset can be specified in only origin from top of the file. When an offset above the file size is specified in write mode, the file size is extended to the offset and the data in the extended area is undefined. This is suitable to create a large file quickly, for fast write operation. After the f_lseek function succeeded, member fptr in the file object should be checked in order to make sure the R/W pointer has been moved correctry. In case of fptr is less than expected value, any of the followings has been occured.</p>
|
||||
<ul>
|
||||
<li>In read-only mode, the Offset was clipped in file size.</li>
|
||||
<li>The drive gets full during the file extending process.</li>
|
||||
<li>There is any error in the FAT structure.</li>
|
||||
</ul>
|
||||
<p>This function is not supported in minimization level of >= 3.</p></div>
|
||||
|
||||
@@ -74,6 +75,23 @@ FRESULT f_lseek (
|
||||
// Move to end of the file to append data
|
||||
res = f_lseek(&file, file.fsize);
|
||||
</pre>
|
||||
<pre>
|
||||
// Cluster pre-allocation (to prevent data overrun on streaming write)
|
||||
|
||||
res = f_open(&file, recfile, FA_CREATE_NEW | FA_WRITE); // Create a file
|
||||
|
||||
res = f_lseek(&file, PRE_SIZE); // Pre-allocate clusters
|
||||
if (res || file.fptr != PRE_SIZE) .... // Check if the file is extended corrctly
|
||||
|
||||
res = f_lseek(&file, DATA_START); // Record data stream without cluster allocation delay
|
||||
...
|
||||
|
||||
res = f_truncate(&file); // Truncate unused area
|
||||
res = f_lseek(&file, 0); // Put file header
|
||||
...
|
||||
|
||||
res = f_close(&file);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user