Go to the previous, next section.

lseek

SYNOPSIS

off_t lseek(int fd, off_t offset, int whence);

PARAMETERS

fd: [in] the file descriptor to manipulate.

offset: [in] the offset modificator.

whence: [in] indicates how to modify the offset.

DESCRIPTION

Changes the read/write file offset of a file descriptor. The offset parameter is interpreted according to the possible following values of whence:

SEEK_SET
the new file offset will be offset.

SEEK_CUR
the new file offset will be the current offset plus offset.

SEEK_END
the new file offset will be the end of the file plus offset.

If we seek past the end of a file, the new file region contain 0.

RETURN VALUE

On success, the call returns the new file offset. On errror, it returns -1 and sets errno to one of the following values:

Go to the previous, next section.