Namespaces
Variants
Views
Actions

std::fpos::state

From cppreference.com
< cpp‎ | io‎ | fpos
Revision as of 08:07, 5 December 2012 by Cubbi (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:ddcl list begin <tr class="t-dcl ">

<td >
State state() const;
</td>

<td > (1) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td >
void state(State st);
</td>

<td > (2) </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end

1) obtains the value of the file position state
2) changes the value of the file position state

For the specializations of std::fpos that are used in the standard library, State is always std::mbstate_t

Contents

Parameters

st - new value for the state

Return value

1) the current value of the fpos state

2) none

Example

#include <iostream>
#include <sstream>
#include <cwchar>
 
int main()
{
    std::istringstream s("test");
    std::mbstate_t st = s.tellg().state();
 
    if(std::mbsinit(&st))
        std::cout << "The stream is in the initial shift state\n";
}

Output:

The stream is in the initial shift state

See also

Template:cpp/string/multibyte/dcl list mbstate t