lseek - move read/write file pointer
long lseek(fildes, offset, whence)
is a file descriptor returned from a
sets the file pointer associated with
is 0, the pointer is set to
is 1, the pointer is set to its current location plus
is 2, the pointer is set to the size of the file plus
Upon successful completion, the resulting pointer location as measured
in bytes from the beginning of file is returned.
will fail and the file pointer will remain unchanged if one or more of
the following are true:
is not an open file descriptor. [EBADF]
is not 0, 1, or 2. [EINVAL]
The resulting file pointer would be negative. [EINVAL]
Some devices are incapable of seeking. The value of the file pointer
associated with such a device is undefined.
Upon successful completion, a non-negative integer indicating the file
pointer value is returned. Otherwise, a value of -1 is returned and
is set to indicate the error.