LSEEK(2,L) AIX Technical Reference LSEEK(2,L)
-------------------------------------------------------------------------------
lseek
PURPOSE
Moves read/write file pointer.
SYNTAX
#include <sys/types.h>
#include <unistd.h>
off_t lseek (fildes, offset, whence)
int fildes;
off_t offset;
int whence;
DESCRIPTION
The lseek system call sets the file pointer for the file specified by the
fildes parameter.
The fildes parameter is a file descriptor obtained from a creat, open, dup, or
fcntl system call.
The lseek system call sets the file pointer associated with the fildes stream
according to the value of the whence parameter, as follows:
SEEK_SET Sets the file pointer to the value of the offset parameter.
SEEK_CUR Sets the file pointer to its current location plus the value of the
offset parameter.
SEEK_END Sets the file pointer to the size of the file plus the value of the
offset parameter.
RETURN VALUE
Upon successful completion, the resulting pointer location as measured in bytes
from the beginning of the file is returned. A negative value may be returned
if the offset parameter was negative; errno is not set. If lseek fails, a
value of -1 is returned and errno is set to indicate the error.
ERROR CONDITIONS
The lseek system call fails and the file pointer remains unchanged if one or
more of the following are true:
EBADF fildes is not an open file descriptor.
Processed November 7, 1990 LSEEK(2,L) 1
LSEEK(2,L) AIX Technical Reference LSEEK(2,L)
ESPIPE fildes is associated with a pipe (FIFO) or a multiplexed special
file.
EINVAL whence is not SEEK_SET, SEEK_CUR, or SEEK_END.
If the Transparent Computing Facility is installed on your system, lseek can
also fail if one or more of the following are true:
ESITEDN1 The file identified by fildes cannot be accessed because a site went
down.
ESITEDN2 The operation was terminated because a site failed.
RELATED INFORMATION
In this book: "dup," "fcntl, flock, lockf," "fseek, rewind, ftell," and "open,
openx, creat."
Processed November 7, 1990 LSEEK(2,L) 2