fpos::state

Sets or returns the conversion state.

Statetype state( ) const; 
void state(
   Statetype _State
);

Parameters

  • _State
    The new conversion state.

Return Value

The conversion state.

Remarks

The first member function returns the value stored in the St member object. The second member function stores _State in the St member object.

Example

// fpos_state.cpp
// compile with: /EHsc
#include <ios>
#include <iostream>
#include <fstream>

int main() {
   using namespace std;
   streamoff s;
   ifstream file( "fpos_state.txt" );

   fpos<mbstate_t> f = file.tellg( );
   char ch;
   while ( !file.eof( ) )
      file.get( ch );
   s = f;
   cout << f.state( ) << endl;
   f.state( 9 );
   cout << f.state( ) << endl;
}

Input: fpos_state.txt

testing

Output

0
9

Requirements

Header: <ios>

Namespace: std

See Also

Reference

fpos Class

iostream Programming

iostreams Conventions

Other Resources

fpos Members