Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::fpos<State>::state

      From cppreference.com
      <cpp‎ |io‎ |fpos
       
       
       
      std::fpos
      Member functions
      fpos::state
       
      State state()const;
      (1)
      void state( State st);
      (2)

      Manages the file position state.

      1) Returns the value of the file position state.
      2) Replaces the file position state with the value ofst.

      For the specializations ofstd::fpos that are used in the standard library,State is alwaysstd::mbstate_t.

      Contents

      [edit]Parameters

      st - new value for the state

      [edit]Return value

      1) The current value of thefpos state.
      2) (none)

      [edit]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

      [edit]Defect reports

      The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

      DRApplied toBehavior as publishedCorrect behavior
      LWG 441C++98overload(1) was not declaredconst (it isconst in thesynopsis)addedconst

      [edit]See also

      conversion state information necessary to iterate multibyte character strings
      (class)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/io/fpos/state&oldid=159105"

      [8]ページ先頭

      ©2009-2025 Movatter.jp