1LSEEK(2)                      System Calls Manual                     LSEEK(2)
2
3
4

NAME

6       lseek, tell - move read/write pointer
7

SYNOPSIS

9       long lseek(fildes, offset, whence)
10       long offset;
11
12       long tell(fildes)
13

DESCRIPTION

15       The  file descriptor refers to a file open for reading or writing.  The
16       read (resp. write) pointer for the file is set as follows:
17
18              If whence is 0, the pointer is set to offset bytes.
19
20              If whence is 1, the pointer is set to its current location  plus
21              offset.
22
23              If  whence is 2, the pointer is set to the size of the file plus
24              offset.
25
26       The returned value is the resulting pointer location.
27
28       The obsolete function tell(fildes) is identical  to  lseek(fildes,  0L,
29       1).
30
31       Seeking  far  beyond  the end of a file, then writing, creates a gap or
32       `hole', which occupies no physical space and reads as zeros.
33

SEE ALSO

35       open(2), creat(2), fseek(3)
36

DIAGNOSTICS

38       -1 is returned for an undefined file descriptor, seek  on  a  pipe,  or
39       seek to a position before the beginning of file.
40

BUGS

42       Lseek is a no-op on character special files.
43

ASSEMBLER

45       (lseek = 19.)
46       (file descriptor in r0)
47       sys lseek; offset1; offset2; whence
48
49       Offset1  and  offset2  are  the high and low words of offset; r0 and r1
50       contain the pointer upon return.
51
52
53
54                                                                      LSEEK(2)
Impressum