lseek(2) DG/UX 5.4.2 lseek(2)
NAME
lseek - change the position of an object pointer
SYNOPSIS
#include <sys/file.h>
#include <sys/types.h>
#include <unistd.h>
offt lseek (fildes, offset, whence)
int fildes;
offt offset;
int whence;
DESCRIPTION
Use lseek(2) to change the position of an object pointer:
fildes is the pointer to be changed: a valid, active file
descriptor having a current position attribute.
offset is the new position of the file pointer.
whence is one of these three values specifying whether offset is
an absolute or incremental address:
SEEK_SET Set fildes to offset bytes.
SEEK_CUR Set fildes to (fildes + offset) bytes.
SEEK_END Set fildes to (sizeof(fildes) + offset) bytes.
The size of character special files and block special files is always
zero. Hence, where fildes points to a character or block special
file, SEEK_END and SEEK_SET are equivalent.
If lseek fails, the object pointer is not changed.
ACCESS CONTROL
None.
RETURN VALUE
position Completed successfully. The object pointer's new position
is returned.
-1 An error occurred. errno is set to indicate the error.
DIAGNOSTICS
Errno may be set to one of the following error codes:
EBADF Fildes is not a valid, active descriptor.
ESPIPE Fildes is associated with a pipe or a socket.
EINVAL The resulting file pointer would be negative.
Licensed material--property of copyright holder(s) 1
lseek(2) DG/UX 5.4.2 lseek(2)
SEE ALSO
creat(2), dup(2), dup2(2), fcntl(2), open(2).
Licensed material--property of copyright holder(s) 2