LSEEK(3spp) RISC/os Reference Manual LSEEK(3spp)
NAME
lseek - move read/write pointer
SYNOPSIS
#include <sys/file.h>
#define LSET 0 /* set the seek pointer */
#define LINCR 1 /* increment the seek pointer */
int lseek(fd, offset, whence)
int fd;
offt offset;
int whence;
DESCRIPTION
The descriptor fd refers to a file or device open for read-
ing and/or writing. Lseek sets the file pointer of d as
follows:
If whence is L_SET, the pointer is set to offset bytes.
If whence is L_INCR, the pointer is set to its current
location plus offset.
Upon successful completion, the resulting pointer location
is returned measured in bytes from beginning of the file.
Some devices are incapable of seeking. The value of the
pointer associated with such a device is undefined.
RETURN VALUE
Upon successful completion, the current file pointer value
is returned. Otherwise, a value of -1 is returned and errno
is set to indicate the error.
ERRORS
Lseek will fail and the file pointer will remain unchanged
if:
[EBADF] fd is not an open file descriptor.
[EINVAL] whence is not a proper value.
SEE ALSO
open(3spp)
BUGS
This document's use of whence is incorrect English, but
maintained for historical reasons.
Printed 1/6/92 Page 1