NAME

lseek - move read/write file pointer

SYNOPSIS

#include <stdio_p.h>

long lseek(fildes, offset, whence)
FD fildes;
long offset;
int whence;

DESCRIPTION

fildes is a file descriptor returned from a open system call. lseek sets the file pointer associated with fildes as follows:

Upon successful completion, the resulting pointer location as measured in bytes from the beginning of file is returned.

lseek will fail and the file pointer will remain unchanged if one or more of the following are true:

Some devices are incapable of seeking. The value of the file pointer associated with such a device is undefined.

RETURN VALUE

Upon 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.

SEE ALSO

open(2F)