INtime SDK Help
lseek

Moves the file pointer to a location specified as an offset from the origin in a file.

#include <unistd.h>

off_t lseek (int handle, off_t offset, int origin);

long64 _lseek64 (int handle, long64 offset, int origin);

Parameters

handle
Descriptor referring to an open file.
offset
Number of bytes from origin, specified as one of these constants, or beyond end-of-file.
Value Description
SEEK_SET Beginning of file.
SEEK_CUR Current position of file pointer.
SEEK_END End of file.
origin Initial position.

Remarks

The next operation on the file occurs at the new location.

lseek can reposition the pointer anywhere in a file and beyond the end of the file. An attempt to position the pointer before the beginning of the file causes an error.

Results are undefined on devices incapable of seeking, like terminals and printers.

Return Values

The offset, in bytes, of the new position from the beginning of the file.
Success.
-1L and the function sets errno to one of these values:
EBADF Invalid file descriptor.
EINVAL Invalid value for origin, or position specified by offset is before the beginning of the file.
EIMPL Library call is not implemented in the current configuration
Failure.

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/io.h unistd.h clib.lib
See Also