LSEEK(2)

NAME
lseek - seek in a file

SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
int lseek (int fildes, off_t offset, int origin);

DESCRIPTION
lseek() will seek filedes to an offset as determined by origin and offset.

Possible values of origin:

0   - seek absolute

1   - seek relative to current position

2
     - seek relative to end of file

The absolute file position is returned on success, a negative value on error.

Note that you can extend a file by seeking past its end, and calling lseek ( filedes, 0,1 ) will return the current value of the file pointer.

ERRORS
-EBADF is returned when filedes is bad.

-ENINVAL is returned when origin is outside the range 0 <= origin <= 2.

-ESPIPE is returned when filedes points to a pipe, which is not seekable.

FILES
linux/fs/read_write.c
/usr/include/linux/sys.h
/usr/include/unistd.h

SEE ALSO
fseek(3)

BUGS
It may be possible to seek before the begining of a file.