FF_Seek()

From FullFAT
Jump to: navigation, search


Seeks the filepointer to the specified position in the file.

Contents

Prototype

FF_ERROR FF_Seek(FF_FILE *pFile, FF_T_SINT32 Offset, FF_T_INT8 Origin);

Back to API.

Parameters

pFile

FF_FILE object from the FF_Open() function.

Offset

Offset from Origin in the file in bytes. This can be both a positive and negative number.

Origin

Possible values are: FF_SEEK_SET - Offset is from the beginning of the file. FF_SEEK_CUR - Offset is from the current position. FF_SEEK_END - Offset if from the end of the file.

Return Value

Return FF_ERR_NONE on success. Returns FF_ERR_NULL_POINTER if pFile was NULL. Returns -3 if the seek results in an invalid position. Returns -4 if Origin is invalid.

Example

#include "fullfat.h"
 
FF_Seek(pFile, 100, FF_SEEK_SET);  // Seek to 100th byte of the file.
FF_Seek(pFile, -100, FF_SEEK_END); // Seek to 100th byte from the end of the file.
 
// etc etc

Back to API.

See Also

Personal tools