pf_lseek

The pf_lseek function moves the file read pointer of the open file.

FRESULT pf_lseek (
  DWORD Offset       /* File offset in unit of byte */
);

Parameters

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, a wrong FAT structure or an internal error.
FR_NOT_OPENED
The file has not been opened.

Description

The pf_lseek function moves the file read pointer of the open file. The offset can be specified in only origin from top of the file.

Example

    // Move to offset of 5000 from top of the file.
    res = pf_lseek(5000);

    // Forward 3000 bytes
    res = pf_lseek(fs.fptr + 3000);

    // Rewind 2000 bytes (take care on overflow)
    res = pf_lseek(fs.fptr - 2000);

QuickInfo

Available when _USE_LSEEK == 1.

References

pf_open, FATFS

Return