header_file.h
unsigned char f_seek( F_FILE *pxFileHandle, long lOffset, unsigned char ucWhence );
Moves the current file read/write position in an open FAT file.
Parameters:
pxFileHandle
|
The handle of the file in which the current file read/write position
is being moved. The handle is returned from the call to
f_open() used to originally open the file.
|
lOffset
|
The byte position (relative to the ucWhence parameter)
to which the current file position will be moved.
|
ucWhence
|
The absolute position from which the lOffset parameter is
relative. Valid values are:
Value
|
Description
|
F_SEEK_CUR
|
The current file position.
|
F_SEEK_END
|
The end of the file.
|
F_SEEK_SET
|
The beginning of the file.
|
|
Returns:
F_NO_ERROR
|
The current file read/write position was successfully moved.
|
Any other value
|
The current file read/write position was not successfully moved.
The returned value holds the error code.
|
See also
f_tell()
Example usage:
void vSampleFunction( char *pcFileName, char *pcBuffer )
{
F_FILE *pxFile;
pxFile = f_open( pcFileName, "r" );
if( pxFile != NULL )
{
f_read( pcBuffer, 1, 1, pxFile );
f_seek( pxFile, 0, F_SEEK_SET );
f_read( pcBuffer, 1, 1, pxFile );
f_seek( pxFile, -1, F_SEEK_END );
f_read( pcBuffer, 1, 1, pxFile );
f_close( pxFile );
}
}
Example use of the f_seek() API function
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.