Line | |
---|
1 | .\" @(#)fseek.3s 6.3 (Berkeley) 2/24/86
|
---|
2 | .\"
|
---|
3 | .TH FSEEK 3 "February 24, 1986"
|
---|
4 | .AT 3
|
---|
5 | .SH NAME
|
---|
6 | fseek, ftell, rewind \- reposition a stream
|
---|
7 | .SH SYNOPSIS
|
---|
8 | .nf
|
---|
9 | .ft B
|
---|
10 | #include <stdio.h>
|
---|
11 |
|
---|
12 | int fseek(FILE *\fIstream\fP, long \fIoffset\fP, int \fIptrname\fP)
|
---|
13 | long ftell(FILE *\fIstream\fP)
|
---|
14 | void rewind(FILE *\fIstream\fP)
|
---|
15 | .ft R
|
---|
16 | .fi
|
---|
17 | .SH DESCRIPTION
|
---|
18 | .B Fseek
|
---|
19 | sets the position of the next input or output
|
---|
20 | operation on the
|
---|
21 | .IR stream .
|
---|
22 | The new position is at the signed distance
|
---|
23 | .I offset
|
---|
24 | bytes
|
---|
25 | from the beginning, the current position, or the end of the file,
|
---|
26 | according as
|
---|
27 | .I ptrname
|
---|
28 | has the value 0, 1, or 2.
|
---|
29 | .PP
|
---|
30 | .B Fseek
|
---|
31 | undoes any effects of
|
---|
32 | .BR ungetc (3).
|
---|
33 | .PP
|
---|
34 | .B Ftell
|
---|
35 | returns the current value of the offset relative to the beginning
|
---|
36 | of the file associated with the named
|
---|
37 | .IR stream .
|
---|
38 | It is measured in bytes on UNIX;
|
---|
39 | on some other systems it is a magic cookie,
|
---|
40 | and the only foolproof way to obtain an
|
---|
41 | .I offset
|
---|
42 | for
|
---|
43 | .BR fseek .
|
---|
44 | .PP
|
---|
45 | .BR Rewind "(\fIstream\fR)"
|
---|
46 | is equivalent to
|
---|
47 | .BR fseek "(\fIstream\fR, 0L, 0)."
|
---|
48 | .SH "SEE ALSO"
|
---|
49 | .BR lseek (2),
|
---|
50 | .BR fopen (3).
|
---|
51 | .SH DIAGNOSTICS
|
---|
52 | .B Fseek
|
---|
53 | returns \-1 for improper seeks, otherwise zero.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.