lseek − move read/write pointer
#include <sys/file.h>
#define L_SET0/* set the seek pointer */
#define L_INCR1/* increment the seek pointer */
pos = lseek(d, offset, whence)
off_t pos;
int d;
off_t offset;
int whence;
The descriptor refers to a file or device open for reading and/or writing. sets the file pointer of as follows: If is L_SET, the pointer is set to bytes. If is L_INCR, the pointer is set to its current location plus Upon successful completion, the resulting pointer location as measured in bytes from beginning of the file is returned. Some devices are incapable of seeking. The value of the pointer associated with such a device is undefined. Upon successful completion, the current file pointer value is returned. Otherwise, a value of −1 is returned and errno is set to indicate the error. will fail and the file pointer will remain unchanged if: [EBADF] is not an open file descriptor. [EINVAL] is not a proper value. open(3spp) This document’s use of is incorrect English, but maintained for historical reasons.