C++ Fstream - fpos Function


It is used in stream position class template. Class template used as a template for types to indicate positions in streams. The template depends on the state type stateT.

The details of this class are implementation-defined, but has at least two members −

stateT state() const;
void state(stateT);


Following is the declaration for std::fpos.


template <class stateT> class fpos;

Objects of any fpos instanced type support construction and conversion from int, and allow consistent conversions to/from values of type streamoff (as well as being added or subtracted values of this type).

Two objects of this type can be compared with operators == and !=. They can also be subtracted, which yields a value of type streamoff.

The synonym types streampos and wstreampos are instantiations of this template with mbstate_t as stateT.