handle exponents greater than 2 digits
[unix-history] / usr / src / lib / libc / stdio / fseek.3
CommitLineData
bb0a128d 1.\" @(#)fseek.3 6.4 (Berkeley) %G%
4f278f49 2.\"
0431d494 3.TH FSEEK 3S ""
4f278f49
KM
4.AT 3
5.SH NAME
6fseek, ftell, rewind \- reposition a stream
7.SH SYNOPSIS
8.B #include <stdio.h>
9.PP
edb5b917 10.B fseek(stream, offset, ptrname)
4f278f49
KM
11.br
12.SM
13.B FILE
14.B *stream;
15.br
16.B long offset;
17.PP
18.B long ftell(stream)
19.br
20.SM
21.B FILE
22.B *stream;
23.PP
24.B rewind(stream)
25.SH DESCRIPTION
26.I Fseek
27sets the position of the next input or output
28operation on the
29.IR stream .
30The new position is at the signed distance
31.I offset
32bytes
33from the beginning, the current position, or the end of the file,
34according as
35.I ptrname
36has the value 0, 1, or 2.
37.PP
38.I Fseek
39undoes any effects of
11d86b43 40.IR ungetc (3S).
4f278f49
KM
41.PP
42.I Ftell
43returns the current value of the offset relative to the beginning
44of the file associated with the named
45.IR stream .
46It is measured in bytes on UNIX;
47on some other systems it is a magic cookie,
48and the only foolproof way to obtain an
49.I offset
50for
51.IR fseek .
52.PP
11d86b43 53.IR Rewind ( stream )
4f278f49 54is equivalent to
11d86b43 55.IR fseek ( stream ,
bb0a128d 560L, L_SET).
4f278f49
KM
57.SH "SEE ALSO"
58lseek(2),
11d86b43 59fopen(3S)
edb5b917
JL
60.SH DIAGNOSTICS
61.I Fseek
62returns \-1 for improper seeks, otherwise zero.