From a6163888f3c56123b1db313743c6147ba498732c Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Fri, 8 Aug 2014 14:42:07 +0300 Subject: Add third_party libs --- .../Common/FileSystem/FatFs-0.7e/doc/en/lseek.html | 111 +++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 third_party/FreeRTOS/Demo/Common/FileSystem/FatFs-0.7e/doc/en/lseek.html (limited to 'third_party/FreeRTOS/Demo/Common/FileSystem/FatFs-0.7e/doc/en/lseek.html') diff --git a/third_party/FreeRTOS/Demo/Common/FileSystem/FatFs-0.7e/doc/en/lseek.html b/third_party/FreeRTOS/Demo/Common/FileSystem/FatFs-0.7e/doc/en/lseek.html new file mode 100644 index 0000000..3639f64 --- /dev/null +++ b/third_party/FreeRTOS/Demo/Common/FileSystem/FatFs-0.7e/doc/en/lseek.html @@ -0,0 +1,111 @@ + + + + + + + +FatFs - f_lseek + + + + +
+

f_lseek

+

The f_lseek function moves the file read/write pointer of an open file object. It can also be used to increase the file size (cluster pre-allocation).

+ +
+FRESULT f_lseek (
+  FIL* FileObject,   /* Pointer to the file object structure */
+  DWORD Offset       /* File offset in unit of byte */
+);
+
+
+ +
+

Parameters

+
+
FileObject
+
Pointer to the open file object.
+
Offset
+
Number of bytes where from start of the file
+
+
+ + +
+

Return Values

+
+
FR_OK (0)
+
The function succeeded.
+
FR_DISK_ERR
+
The function failed due to an error in the disk function.
+
FR_INT_ERR
+
The function failed due to a wrong FAT structure or an internal error.
+
FR_NOT_READY
+
The disk drive cannot work due to no medium in the drive or any other reason.
+
FR_INVALID_OBJECT
+
The file object is invalid.
+
+
+ + +
+

Description

+

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 increased and the data in the expanded 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 not the expected value, either of followings has been occured.

+ +
+ + +
+

QuickInfo

+

Available when _FS_MINIMIZE <= 2.

+
+ + +
+

Example

+
+    /* Move to offset of 5000 from top of the file */
+    res = f_lseek(file, 5000);
+
+    /* Move to end of the file to append data */
+    res = f_lseek(file, file->fsize);
+
+    /* Forward 3000 bytes */
+    res = f_lseek(file, file->fptr + 3000);
+
+    /* Rewind 2000 bytes (take care on overflow) */
+    res = f_lseek(file, file->fptr - 2000);
+
+
+    /* Cluster pre-allocation (to prevent buffer 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 size has been increased correctly */
+
+    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);
+
+
+ + +
+

See Also

+

f_open, f_truncate, FIL

+
+ +

Return

+ + -- cgit v1.3.1