FSEEK(3) BSD Programmer's Manual FSEEK(3)
f
\bfg
\bge
\bet
\btp
\bpo
\bos
\bs, f
\bfs
\bse
\bee
\bek
\bk, f
\bfs
\bse
\bet
\btp
\bpo
\bos
\bs, f
\bft
\bte
\bel
\bll
\bl, r
\bre
\bew
\bwi
\bin
\bnd
\bd - reposition a stream
S
\bSY
\bYN
\bNO
\bOP
\bPS
\bSI
\bIS
\bS
#
\b#i
\bin
\bnc
\bcl
\blu
\bud
\bde
\be <
\b<s
\bst
\btd
\bdi
\bio
\bo.
\b.h
\bh>
\b>
f
\bfs
\bse
\bee
\bek
\bk(_
\bF_
\bI_
\bL_
\bE _
\b*_
\bs_
\bt_
\br_
\be_
\ba_
\bm, _
\bl_
\bo_
\bn_
\bg _
\bo_
\bf_
\bf_
\bs_
\be_
\bt, _
\bi_
\bn_
\bt _
\bw_
\bh_
\be_
\bn_
\bc_
\be);
f
\bft
\bte
\bel
\bll
\bl(_
\bF_
\bI_
\bL_
\bE _
\b*_
\bs_
\bt_
\br_
\be_
\ba_
\bm);
r
\bre
\bew
\bwi
\bin
\bnd
\bd(_
\bF_
\bI_
\bL_
\bE _
\b*_
\bs_
\bt_
\br_
\be_
\ba_
\bm);
f
\bfg
\bge
\bet
\btp
\bpo
\bos
\bs(_
\bF_
\bI_
\bL_
\bE _
\b*_
\bs_
\bt_
\br_
\be_
\ba_
\bm, _
\bf_
\bp_
\bo_
\bs_
\b__
\bt _
\b*_
\bp_
\bo_
\bs);
f
\bfs
\bse
\bet
\btp
\bpo
\bos
\bs(_
\bF_
\bI_
\bL_
\bE _
\b*_
\bs_
\bt_
\br_
\be_
\ba_
\bm, _
\bf_
\bp_
\bo_
\bs_
\b__
\bt _
\b*_
\bp_
\bo_
\bs);
D
\bDE
\bES
\bSC
\bCR
\bRI
\bIP
\bPT
\bTI
\bIO
\bON
\bN
The f
\bfs
\bse
\bee
\bek
\bk() function sets the file position indicator for the stream
pointed to by _
\bs_
\bt_
\br_
\be_
\ba_
\bm. The new position, measured in bytes, is obtained by
adding _
\bo_
\bf_
\bf_
\bs_
\be_
\bt bytes to the position specified by _
\bw_
\bh_
\be_
\bn_
\bc_
\be. If _
\bw_
\bh_
\be_
\bn_
\bc_
\be is set
to SEEK_SET, SEEK_CUR, or SEEK_END, the offset is relative to the start
of the file, the current position indicator, or end-of-file, respective-
ly. A successful call to the f
\bfs
\bse
\bee
\bek
\bk() function clears the end-of-file in-
dicator for the stream and undoes any effects of the ungetc(3) function
The f
\bft
\bte
\bel
\bll
\bl() function obtains the current value of the file position indi-
cator for the stream pointed to by _
\bs_
\bt_
\br_
\be_
\ba_
\bm.
The r
\bre
\bew
\bwi
\bin
\bnd
\bd() function sets the file position indicator for the stream
pointed to by _
\bs_
\bt_
\br_
\be_
\ba_
\bm to the beginning of the file. It is equivalent to:
(void)fseek(stream, 0L, SEEK_SET)
except that the error indicator for the stream is also cleared (see
The f
\bfg
\bge
\bet
\btp
\bpo
\bos
\bs() and f
\bfs
\bse
\bet
\btp
\bpo
\bos
\bs() functions are alternate interfaces equivalent
to f
\bft
\bte
\bel
\bll
\bl() and f
\bfs
\bse
\bee
\bek
\bk() (with whence set to SEEK_SET ), setting and stor-
ing the current value of the file offset into or from the object refer-
enced by _
\bp_
\bo_
\bs. On some (non-UNIX) systems an ``_
\bf_
\bp_
\bo_
\bs_
\b__
\bt'' object may be a
complex object and these routines may be the only way to portably reposi-
R
\bRE
\bET
\bTU
\bUR
\bRN
\bN V
\bVA
\bAL
\bLU
\bUE
\bES
\bS
The r
\bre
\bew
\bwi
\bin
\bnd
\bd() function returns no value. Upon successful completion,
f
\bfg
\bge
\bet
\btp
\bpo
\bos
\bs(), f
\bfs
\bse
\bee
\bek
\bk(), f
\bfs
\bse
\bet
\btp
\bpo
\bos
\bs() return 0, and f
\bft
\bte
\bel
\bll
\bl() returns the current
offset. Otherwise, -1 is returned and the global variable errno is set
[EBADF] The _
\bs_
\bt_
\br_
\be_
\ba_
\bm specified is not a seekable stream.
[EINVAL] The _
\bw_
\bh_
\be_
\bn_
\bc_
\be argument to f
\bfs
\bse
\bee
\bek
\bk() was not SEEK_SET, SEEK_END, or
The function f
\bfg
\bge
\bet
\btp
\bpo
\bos
\bs(), f
\bfs
\bse
\bee
\bek
\bk(), f
\bfs
\bse
\bet
\btp
\bpo
\bos
\bs(), and f
\bft
\bte
\bel
\bll
\bl() may also fail and
set _
\be_
\br_
\br_
\bn_
\bo for any of the errors specified for the routines fflush(3),
fstat(2), lseek(2), and malloc(3).
S
\bSE
\bEE
\bE A
\bAL
\bLS
\bSO
\bO
S
\bST
\bTA
\bAN
\bND
\bDA
\bAR
\bRD
\bDS
\bS
The f
\bfg
\bge
\bet
\btp
\bpo
\bos
\bs(), f
\bfs
\bse
\bet
\btp
\bpo
\bos
\bs(), f
\bfs
\bse
\bee
\bek
\bk(), f
\bft
\bte
\bel
\bll
\bl(), and r
\bre
\bew
\bwi
\bin
\bnd
\bd() functions con-
form to ANSI C X3.159-1989 (``ANSI C '').