Commit | Line | Data |
---|---|---|
a6c517c9 C |
1 | .TH FSEEK 3S "19 January 1983" |
2 | .SH NAME | |
3 | fseek, 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 | |
24 | sets the position of the next input or output | |
25 | operation on the | |
26 | .IR stream . | |
27 | The new position is at the signed distance | |
28 | .I offset | |
29 | bytes | |
30 | from the beginning, the current position, or the end of the file, | |
31 | according as | |
32 | .I ptrname | |
33 | has the value 0, 1, or 2. | |
34 | .PP | |
35 | .I Fseek | |
36 | undoes any effects of | |
37 | .IR ungetc (3S). | |
38 | .PP | |
39 | .I Ftell | |
40 | returns the current value of the offset relative to the beginning | |
41 | of the file associated with the named | |
42 | .IR stream . | |
43 | It is measured in bytes on UNIX; | |
44 | on some other systems it is a magic cookie, | |
45 | and the only foolproof way to obtain an | |
46 | .I offset | |
47 | for | |
48 | .IR fseek . | |
49 | .PP | |
50 | .IR Rewind ( stream ) | |
51 | is equivalent to | |
52 | .IR fseek ( stream , | |
53 | 0L, 0). | |
54 | .SH "SEE ALSO" | |
55 | lseek(2), | |
56 | fopen(3S) | |
57 | .SH DIAGNOSTICS | |
58 | .I Fseek | |
59 | returns \-1 for improper seeks. |