std::fpos::state(3)
β¨ std::fpos::state(3) β¨ β C++ Standard Libary
πΈ NAME πΈ
std::fpos::state β std::fpos::state. Thatβs the name, and honestly? iconic. π
π¦ Synopsis π¦
State state() const; (1)
void state( State st ); (2)
This little duo manages the file position state. π«Ά
- Returns the value of the file position state.
- Replaces the file position state with the value of
st.
Real talk: for the specializations of std::fpos that are used in the standard library, State is always std::mbstate_t. No cap. π
π Parameters π
stβ new value for the state.
π Return value π
- The current value of the
fposstate. - (none)
π¦ Example π¦
// Run this code
#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
π Defect reports π
The following behavior-changing defect reports were applied retroactively to previously published C++ standards. Yes, the lore goes back. π
- DR:
LWG 441- Applied to:
C++98 - Behavior as published: overload (1) was not declared
const(it isconstin the synopsis) - Correct behavior: added
const
- Applied to:
π See also π
mbstate_tβ conversion state information necessary to iterate multibyte character strings (class).
π Thatβs the whole page, bestie! Source:http://cppreference.comΒ· version/date:2024.06.10Β·std::fpos::state(3)and we are so done. ππ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms