Positions the file read or write offset.
#include <unistd.h>
off_t lseek (
int fildes,
off_t offset,
int whence);
(IN) Specifies a file descriptor.
(IN) Specifies the relative offset from the file position specified by the whence parameter.
(IN) Specifies the seek starting point and uses one of the following flags:
If successful, returns the resulting offset, as measured in bytes from the beginning of the file. Otherwise, returns -1 and sets errno to one of the following:
The lseek function allows the file offset to be set beyond the end of existing data in the file. If data is written at this point, a data gap results. A subsequent read to the gap returns bytes with a zero value until data is actually written into the gap.
The lseek function cannot, by itself, extend the size of a file.