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