blob: ff982262e9bc988dfc9de76e23625f7538b65f5b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
.TH LSEEK 2
.CT 2 file_io
.SH NAME
lseek \(mi seek, move read/write pointer
.SH SYNOPSIS
.nf
.B long lseek(fildes, offset, whence)
.B long offset;
.fi
.SH DESCRIPTION
.I Lseek
sets the file pointer for the file
associated with
.I fildes
as follows:
.IP
If
.I whence
is 0, the pointer is set to
.I offset
bytes.
.IP
If
.I whence
is 1, the pointer is set to its current location plus
.IR offset .
.IP
If
.I whence
is 2, the pointer is set to the size of the
file plus
.IR offset .
.PP
The new file pointer value is returned.
.PP
Seeking far beyond the end of a file, then writing,
creates a gap or `hole,' which occupies no
physical space and reads as zeros.
.SH "SEE ALSO"
.IR open (2),
.IR fseek (3)
.SH DIAGNOSTICS
.BR EBADF ,
.BR ESPIPE
.SH BUGS
.I Lseek
doesn't affect some special files.
|