Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ lseek(2) — A/UX 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

creat(2)

dup(2)

fcntl(2)

open(2)




lseek(2) lseek(2)
NAME lseek - move read/write file pointer SYNOPSIS #include <sys/types.h> #include <unistd.h> off_t lseek(fildes, offset, whence) int fildes; off_t offset; int whence; DESCRIPTION The file descriptor fildes is returned from a creat, open, dup, or fcntl system call. lseek sets the file pointer associated with fildes as follows: If whence is 0, the pointer is set to offset bytes. If whence is 1, the pointer is set to its current location plus offset. If whence is 2, the pointer is set to the size of the file plus offset. In the POSIX environment, the following values are defined in <unistd.h> for passing as the value of whence: SEEK_SET 0 SEEK_CUR 1 SEEK_END 2 On successful completion, the resulting pointer location, as measured in bytes from the beginning of the file, is returned. STATUS MESSAGES AND VALUES On successful completion, a non-negative integer indicating the file pointer value is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error. The lseek program will fail and the file pointer will remain unchanged if one or more of the following is true: EBADF fildes is not an open file descriptor. ESPIPE January 1992 1



lseek(2) lseek(2)
fildes is associated with a pipe or FIFO. EINVAL whence is not 0, 1, or 2. EINVAL The resulting file pointer would be negative. Some devices are incapable of seeking. The value of the file pointer associated with such a device is undefined. SEE ALSO creat(2), dup(2), fcntl(2), open(2) 2 January 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026