Move a file pointer to a specified location.
Include
<unistd.h>
Prototype
long lseek(int handle, long offset, int
origin);
Arguments
handle | |
offset | |
origin |
Return Value
Returns the offset, in characters, of the new position from the beginning of the file.
The function returns -1 to indicate an error and sets errno
.
Appropriate values might be EBADF
or EINVAL
.
Remarks
This function is implemented as a stub that must be completed to suite the application.
This helper function is called by the Standard C Library functions
fgetpos()
, ftell()
, fseek()
,
fsetpos
and rewind()
.
<stdio.h>
):
Origin | |
---|---|
SEEK_SET |
Beginning of file |
SEEK_CUR |
Current position of file pointer |
SEEK_END |
End-of-file |
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.
Source File
lseek.c