version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
FSEEK |
|
|
2 |
!!!FSEEK |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
RETURN VALUE |
|
|
7 |
ERRORS |
|
|
8 |
CONFORMING TO |
|
|
9 |
SEE ALSO |
|
|
10 |
---- |
|
|
11 |
!!NAME |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
fgetpos, fseek, fsetpos, ftell, rewind - reposition a stream |
|
|
15 |
!!SYNOPSIS |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
__#include __ |
|
|
19 |
|
|
|
20 |
|
|
|
21 |
__int fseek( FILE *__''stream''__, long__ |
|
|
22 |
''offset''__, int__ ''whence''__); |
|
|
23 |
long ftell( FILE *__''stream''__); |
|
|
24 |
void rewind( FILE *__''stream''__); |
|
|
25 |
int fgetpos( FILE *__''stream''__, fpos_t |
|
|
26 |
*__''pos''__); |
|
|
27 |
int fsetpos( FILE *__''stream''__, fpos_t |
|
|
28 |
*__''pos''__);__ |
|
|
29 |
!!DESCRIPTION |
|
|
30 |
|
|
|
31 |
|
|
|
32 |
The __fseek__ function sets the file position indicator |
|
|
33 |
for the stream pointed to by ''stream''. The new |
|
|
34 |
position, measured in bytes, is obtained by adding |
|
|
35 |
''offset'' bytes to the position specified by |
|
|
36 |
''whence''. If ''whence'' is set to __SEEK_SET__, |
|
|
37 |
__SEEK_CUR__, or __SEEK_END__, the offset is relative |
|
|
38 |
to the start of the file, the current position indicator, or |
|
|
39 |
end-of-file, respectively. A successful call to the |
|
|
40 |
__fseek__ function clears the end-of-file indicator for |
|
|
41 |
the stream and undoes any effects of the ungetc(3) |
|
|
42 |
function on the same stream. |
|
|
43 |
|
|
|
44 |
|
|
|
45 |
The __ftell__ function obtains the current value of the |
|
|
46 |
file position indicator for the stream pointed to by |
|
|
47 |
''stream''. |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
The __rewind__ function sets the file position indicator |
|
|
51 |
for the stream pointed to by ''stream'' to the beginning |
|
|
52 |
of the file. It is equivalent to: |
|
|
53 |
|
|
|
54 |
|
|
|
55 |
(void)fseek(stream, 0L, SEEK_SET) |
|
|
56 |
|
|
|
57 |
|
|
|
58 |
except that the error indicator for the stream is also |
|
|
59 |
cleared (see clearerr(3)). |
|
|
60 |
|
|
|
61 |
|
|
|
62 |
The __fgetpos__ and __fsetpos__ functions are |
|
|
63 |
alternate interfaces equivalent to __ftell__ and |
|
|
64 |
__fseek__ (with whence set to __SEEK_SET__), setting |
|
|
65 |
and storing the current value of the file offset into or |
|
|
66 |
from the object referenced by ''pos''. On some non-UNIX |
|
|
67 |
systems an __fpos_t__ object may be a complex object and |
|
|
68 |
these routines may be the only way to portably reposition a |
|
|
69 |
text stream. |
|
|
70 |
!!RETURN VALUE |
|
|
71 |
|
|
|
72 |
|
|
|
73 |
The __rewind__ function returns no value. Upon successful |
|
|
74 |
completion, __fgetpos__, __fseek__, __fsetpos__ |
|
|
75 |
return 0, and __ftell__ returns the current offset. |
|
|
76 |
Otherwise, -1 is returned and the global variable errno is |
|
|
77 |
set to indicate the error. |
|
|
78 |
!!ERRORS |
|
|
79 |
|
|
|
80 |
|
|
|
81 |
__EBADF__ |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
The ''stream'' specified is not a seekable |
|
|
85 |
stream. |
|
|
86 |
|
|
|
87 |
|
|
|
88 |
__EINVAL__ |
|
|
89 |
|
|
|
90 |
|
|
|
91 |
The ''whence'' argument to __fseek__ was not |
|
|
92 |
__SEEK_SET__, __SEEK_END__, or |
|
|
93 |
__SEEK_CUR__. |
|
|
94 |
|
|
|
95 |
|
|
|
96 |
The function __fgetpos__, __fseek__, __fsetpos__, |
|
|
97 |
and __ftell__ may also fail and set ''errno'' for any |
|
|
98 |
of the errors specified for the routines fflush(3), |
|
|
99 |
fstat(2), lseek(2), and |
|
|
100 |
malloc(3). |
|
|
101 |
!!CONFORMING TO |
|
|
102 |
|
|
|
103 |
|
|
|
104 |
The __fgetpos__, __fsetpos__, __fseek__, |
|
|
105 |
__ftell__, and __rewind__ functions conform to ANSI |
|
|
106 |
X3.159-1989 (``ANSI C''). |
|
|
107 |
!!SEE ALSO |
|
|
108 |
|
|
|
109 |
|
|
|
110 |
lseek(2) |
|
|
111 |
---- |