Move a file pointer to a specified location.
Include
None
Prototype
long lseek(int handle, long offset, int
origin);
Arguments
handle |
refers to an opened file |
offset |
the number of characters from the origin |
origin |
the position from which to start the seek. origin may be one of the following values (as defined in stdio.h): SEEK_SET – Beginning of file. SEEK_CUR – Current position of file pointer. SEEK_END – End-of-file. |
Return Value
Returns the offset, in characters, of the new position from the beginning of the file. A return value of ‘-1L’ indicates an error.
Remarks
This helper function is called by the Standard C Library functions
fgetpos()
, ftell()
, fseek()
,
fsetpos
and rewind()
.
Default Behavior
As distributed, the parameters are passed to the host file system through the simulator. The return value is the value returned by the host file system.
File
lseek.c