Skip to content. Skip to navigation

ICTP Portal

You are here: Home Manuals on-line PGI Compiler pgC_lib fpos
Personal tools
Document Actions


Click on the banner to return to the class reference home page.


Data Type and Member Function Indexes
(exclusive of constructors and destructors)


#include <rw/iotraits>
template<class stateT = mbstate_t>
class fpos


The template class fpos<stateT> is used by the iostream classes to maintain positioning information. It maintains three kinds of information: the absolute position, the conversion state and the validity of the stored position. Streams instantiated on tiny characters use streampos as their positioning type, whereas streams instantiated on wide characters use wstreampos, but both are defined as fpos<mbstate_t>.


template <class stateT = mbstate_t> 
class fpos {

  typedef stateT  state_type;

  fpos(long off = 0);

  state_type   state(state_type); 
  state_type   state () const;




    The type state_type holds the conversion state, and is compatible with the function locale::codecvt(). By default it is defined as mbstate_t.

Public Constructors

fpos(long off =0);

    Constructs an fpos object, initializing its position with off and its conversion state with the default stateT constructor. This function is not described in the C++ standard.

fpos(state_type st);

    Construct an fpos object, initializing its conversion state with st, its position with the start position, and its status to good.

Public Member Functions

state() const;

    Returns the conversion state stored in the fpos object.

state(state_type st);

    Store st as the new conversion state in the fpos object and return its previous value.

Valid Operations

In the following,

  • P refers to type fpos<stateT>

  • p and q refer to an value of type fpos<stateT>

  • O refers to the offset type ( streamoff, wstreamoff, long _)

  • o refers to a value of the offset type

  • i refers to a value of type int

Valid operations:

    P p( i );
    Constructs from int.
    P p = i;
    Assigns from int.
    P( o )
    Converts from offset.
    O( p )
    Converts to offset.
    p == q
    Tests for equality.
    p != q
    Tests for inequality.
    q = p + o
    Adds offset.
    p += o
    Adds offset.
    q = p -o
    Subtracts offset.
    q -= o
    Subtracts offset.
    o = p - q
    Returns offset.

See Also

iosfwd(3C++), char_traits(3C++)

Working Paper for Draft Proposed International Standard for Information Systems--Programming Language C++, Section 27.4.

Amendment 1 to the C Standard.

Standards Conformance

ANSI X3J16/ISO WG21 Joint C++ Committee

©Copyright 1996, Rogue Wave Software, Inc.

Powered by Plone This site conforms to the following standards: