remove fseek: back to old version returning int
[unix-history] / usr / src / lib / libc / stdio / fseek.3
CommitLineData
3c692b4c 1.\" @(#)fseek.3 6.2 (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
3c692b4c 10.B long 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.
3c692b4c
KM
37.I Fseek
38returns \-1 for improper seeks,
39otherwise it returns the new value of the offset relative
40to the beginning of the file associated with the named
41.IR stream .
4f278f49
KM
42.PP
43.I Fseek
44undoes any effects of
11d86b43 45.IR ungetc (3S).
4f278f49
KM
46.PP
47.I Ftell
48returns the current value of the offset relative to the beginning
49of the file associated with the named
50.IR stream .
51It is measured in bytes on UNIX;
52on some other systems it is a magic cookie,
53and the only foolproof way to obtain an
54.I offset
55for
56.IR fseek .
57.PP
11d86b43 58.IR Rewind ( stream )
4f278f49 59is equivalent to
11d86b43
KM
60.IR fseek ( stream ,
610L, 0).
4f278f49
KM
62.SH "SEE ALSO"
63lseek(2),
11d86b43 64fopen(3S)