.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\" @(#)lseek.2 6.4 (Berkeley) %G%
lseek \- move read/write pointer
pos = lseek(d, offset, whence)
refers to a file or device open for reading and/or writing.
is SEEK_SET, the pointer is set to
is SEEK_CUR, the pointer is set to its current location plus
is SEEK_END, the pointer is set to the size of the
Upon successful completion, the resulting pointer location
as measured in bytes from beginning of the file is returned.
Some devices are incapable of seeking. The value of the pointer
associated with such a device is undefined.
Seeking far beyond the end of a file, then writing,
creates a gap or \*(lqhole\*(rq, which occupies no
physical space and reads as zeros.
Upon successful completion,
the current file pointer value is returned.
a value of \-1 is returned and \fIerrno\fP is set to indicate
will fail and the file pointer will remain unchanged if:
is not an open file descriptor.
is associated with a pipe or a socket.
is incorrect English, but maintained for historical reasons.