home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 4
/
FreshFish_May-June1994.bin
/
gnu
/
man
/
cat2
/
lseek.0
< prev
next >
Wrap
Text File
|
1993-12-07
|
2KB
|
67 lines
LSEEK(2) UNIX Programmer's Manual LSEEK(2)
NNAAMMEE
llsseeeekk - reposition read/write file offset
SSYYNNOOPPSSIISS
##iinncclluuddee <<uunniissttdd..hh>>
_o_f_f___t
llsseeeekk(_i_n_t _f_i_l_d_e_s, _o_f_f___t _o_f_f_s_e_t, _i_n_t _w_h_e_n_c_e)
DDEESSCCRRIIPPTTIIOONN
The llsseeeekk() function repositions the offset of the file descriptor _f_i_l_d_e_s
to the argument _o_f_f_s_e_t according to the directive _w_h_e_n_c_e_. The argument
_f_i_l_d_e_s must be an open file descriptor. LLsseeeekk() repositions the file
pointer _f_i_l_d_e_s as follows:
If _w_h_e_n_c_e is SEEK_SET, the offset is set to _o_f_f_s_e_t bytes.
If _w_h_e_n_c_e is SEEK_CUR, the offset is set to its current location
plus _o_f_f_s_e_t bytes.
If _w_h_e_n_c_e is SEEK_END, the offset is set to the size of the file
plus _o_f_f_s_e_t bytes.
The llsseeeekk() function allows the file offset to be set beyond the end of
the existing endoffile of the file. If data is later written at this
point, subsequent reads of the data in the gap return bytes of zeros (un
til data is actualy written into the gap).
Some devices are incapable of seeking. The value of the pointer associ
ated with such a device is undefined.
RREETTUURRNN VVAALLUUEESS
Upon successful completion, llsseeeekk() returns the resulting offset location
as measured in bytes from the begining of the file. Otherwise, a value
of 1 is returned and _e_r_r_n_o is set to indicate the error.
EERRRROORRSS
LLsseeeekk() will fail and the file pointer will remain unchanged if:
[EBADF] _F_i_l_d_e_s is not an open file descriptor.
[ESPIPE] _F_i_l_d_e_s is associated with a pipe, socket, or FIFO.
[EINVAL] _W_h_e_n_c_e is not a proper value.
SSEEEE AALLSSOO
dup(2), open(2)
BBUUGGSS
This document's use of _w_h_e_n_c_e is incorrect English, but maintained for
historical reasons.
SSTTAANNDDAARRDDSS
The llsseeeekk() function conforms to IEEE Std 1003.11988 (``POSIX'').
4th Berkeley Distribution March 10, 1991 1