3 <<fgetpos>>---record position in a stream or file
12 int fgetpos(FILE *<[fp]>, fpos_t *<[pos]>);
13 int _fgetpos_r(struct _reent *<[ptr]>, FILE *<[fp]>, fpos_t *<[pos]>);
17 int fgetpos(<[fp]>, <[pos]>)
21 int _fgetpos_r(<[ptr]>, <[fp]>, <[pos]>)
22 struct _reent *<[ptr]>;
27 Objects of type <<FILE>> can have a ``position'' that records how much
28 of the file your program has already read. Many of the <<stdio>> functions
29 depend on this position, and many change it as a side effect.
31 You can use <<fgetpos>> to report on the current position for a file
32 identified by <[fp]>; <<fgetpos>> will write a value
33 representing that position at <<*<[pos]>>>. Later, you can
34 use this value with <<fsetpos>> to return the file to this
37 In the current implementation, <<fgetpos>> simply uses a character
38 count to represent the file position; this is the same number that
39 would be returned by <<ftell>>.
42 <<fgetpos>> returns <<0>> when successful. If <<fgetpos>> fails, the
43 result is <<1>>. Failure occurs on streams that do not support
44 positioning; the global <<errno>> indicates this condition with the
48 <<fgetpos>> is required by the ANSI C standard, but the meaning of the
49 value it records is not specified beyond requiring that it be
50 acceptable as an argument to <<fsetpos>>. In particular, other
51 conforming C implementations may return a different result from
52 <<ftell>> than what <<fgetpos>> writes at <<*<[pos]>>>.
54 No supporting OS subroutines are required.
60 _DEFUN (_fgetpos_r
, (ptr
, fp
, pos
),
61 struct _reent
* ptr _AND
66 *pos
= _ftell_r (ptr
, fp
);
80 _DEFUN (fgetpos
, (fp
, pos
),
84 return _fgetpos_r (_REENT
, fp
, pos
);
87 #endif /* !_REENT_ONLY */