Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::basic_filebuf<CharT,Traits>::overflow

      From cppreference.com
      <cpp‎ |io‎ |basic filebuf
       
       
       
       
      protected:
      virtual int_type overflow( int_type ch= Traits::eof());

      Writes some data from the put area to the associated character sequence (to the file).

      Behaves like the base class versionstd::basic_streambuf::overflow(), except that the behavior of “consuming characters” is defined as follows:

      1) First, usesstd::codecvt::out of the imbued locale to convert the characters into external (possibly multibyte) representation, stored in a temporary buffer, as follows: (XSIZE is some unspecified buffer size)
      conststd::codecvt<CharT,char,typename Traits::state_type>& a_codecvt=std::use_facet<std::codecvt<CharT,char,typename Traits::state_type>>(getloc());typename Traits::state_type state;CharT* end;char xbuf[XSIZE];char* xbuf_end;std::codecvt_base::result r=    a_codecvt.out(state, pbase(), pptr(), end, xbuf, xbuf+ XSIZE, xbuf_end);
      2) Then writes all fully-converted characters from the buffer into the file. Formally, performs the following steps based on the value ofr:
      rOperation
      std::codecvt_base::okOutput characters in[xbufxbuf_end) to the file, and fail if output fails. At this point ifpbase()!= pptr() andpbase()== end are bothtrue (which meansxbuf is not large enough for even one external character), then increaseXSIZE and repeat from the beginning.
      std::codecvt_base::partialOutput the converted external characters in[xbufxbuf_end) to the file, and repeat using the remaining unconverted internal characters in[endpptr()). If output fails, fail (without repeating).
      std::codecvt_base::noconvOutput characters in[pbase()pptr()) to the file.
      std::codecvt_base::errorFail.
      If the associated file is not open (is_open() returnsfalse), output will always fail.
      3) Establishes anobservable checkpoint.
      (since C++26)

      Contents

      [edit]Parameters

      ch - the character to store in the put area

      [edit]Return value

      Traits::not_eof(ch) to indicate success orTraits::eof() to indicate failure.

      [edit]Notes

      Ifa_codecvt.always_noconv() returnstrue, the call toa_codecvt.out() may be skipped.

      [edit]Example

      This section is incomplete
      Reason: no example

      [edit]See also

      [virtual]
      writes characters to the associated output sequence from the put area
      (virtual protected member function ofstd::basic_streambuf<CharT,Traits>)[edit]
      [virtual]
      reads from the associated file
      (virtual protected member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/io/basic_filebuf/overflow&oldid=181823"

      [8]ページ先頭

      ©2009-2025 Movatter.jp