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