67 lines
1.0 KiB
Groff
67 lines
1.0 KiB
Groff
.TH LSEEK 2
|
|
.UC 4
|
|
.SH NAME
|
|
lseek \- seek in a file
|
|
.SH SYNOPSIS
|
|
.nf
|
|
.B #include <sys/types.h>
|
|
.B #include <unistd.h>
|
|
.B "int lseek (int fildes, off_t offset, int origin);"
|
|
.fi
|
|
.SH DESCRIPTION
|
|
.B lseek()
|
|
will seek
|
|
.I filedes
|
|
to an offset as determined by
|
|
.I origin
|
|
and
|
|
.I offset.
|
|
.PP
|
|
Possible values of
|
|
.I origin:
|
|
.br
|
|
.IP 0
|
|
- seek absolute
|
|
.IP 1
|
|
- seek relative to current position
|
|
.IP 2
|
|
- seek relative to end of file
|
|
.PP
|
|
The absolute file position is returned on success, a negative value on error.
|
|
.PP
|
|
Note that you can extend a file by seeking past its end, and calling
|
|
.B lseek
|
|
(
|
|
.I filedes,
|
|
0,1
|
|
) will return the current value of the file pointer.
|
|
|
|
.SH ERRORS
|
|
.B -EBADF
|
|
is returned when
|
|
.I filedes
|
|
is bad.
|
|
.PP
|
|
.B -ENINVAL
|
|
is returned when
|
|
.I origin
|
|
is outside the range
|
|
0 <=
|
|
.I origin
|
|
<= 2.
|
|
.PP
|
|
.B -ESPIPE
|
|
is returned when
|
|
.I filedes
|
|
points to a pipe, which is not seekable.
|
|
.SH FILES
|
|
linux/fs/read_write.c
|
|
.br
|
|
/usr/include/linux/sys.h
|
|
.br
|
|
/usr/include/unistd.h
|
|
.SH SEE ALSO
|
|
fseek(3)
|
|
.SH BUGS
|
|
It may be possible to seek before the begining of a file.
|