LSEEK(2) DOMAIN/IX SYS5 LSEEK(2)
NAME
lseek - move read/write file pointer
USAGE
long lseek(fildes, offset, whence)
int fildes;
long offset;
int whence;
DESCRIPTION
Fildes is a file descriptor returned from a creat, open,
dup, or fcntl system call. Lseek sets the file pointer
associated with fildes according to the value of whence, as
shown below.
⊕ If whence is 0, the pointer is set at offset bytes into
the file.
⊕ If whence is 1, the pointer is set to its current loca-
tion plus offset.
⊕ If whence is 2, the pointer is set to the size of the
file plus offset.
NOTES
Some devices are incapable of seeking. The value of the
file pointer associated with such a device is undefined.
RETURN VALUE
A successful call returns a non-negative integer indicating
the new file pointer location. A failed call returns -1 and
sets errno as indicated below.
ERRORS
Lseek will fail and the file pointer will remain unchanged
if one or more of the following is true:
[EBADF] Fildes is not an open file descriptor.
[ESPIPE] Fildes is associated with a pipe or FIFO.
[EINVAL and SIGSYS signal]
Whence is not 0, 1, or 2.
[EINVAL] The resulting file pointer would be negative.
Printed 12/4/86 LSEEK-1
LSEEK(2) DOMAIN/IX SYS5 LSEEK(2)
RELATED INFORMATION
creat(2), dup(2), fcntl(2), open(2)
LSEEK-2 Printed 12/4/86