| I/O manipulators | ||||
| Print functions(C++23) | ||||
| C-style I/O | ||||
| Buffers | ||||
(C++23) | ||||
(C++98/26*) | ||||
(C++20) | ||||
| Streams | ||||
| Abstractions | ||||
| File I/O | ||||
| String I/O | ||||
| Array I/O | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
(C++98/26*) | ||||
(C++98/26*) | ||||
(C++98/26*) | ||||
| Synchronized Output | ||||
(C++20) | ||||
| Types | ||||
| Error category interface | ||||
(C++11) | ||||
(C++11) |
State state()const; | (1) | |
void state( State st); | (2) | |
Manages the file position state.
For the specializations ofstd::fpos that are used in the standard library,State is alwaysstd::mbstate_t.
Contents |
| st | - | new value for the state |
fpos state.#include <cwchar>#include <iostream>#include <sstream> 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
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 441 | C++98 | overload(1) was not declaredconst (it isconst in thesynopsis) | addedconst |
| conversion state information necessary to iterate multibyte character strings (class)[edit] |