Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::basic_streambuf<CharT,Traits>::sgetn,std::basic_streambuf<CharT,Traits>::xsgetn

      From cppreference.com
      <cpp‎ |io‎ |basic streambuf
       
       
       
      std::basic_streambuf
       
      std::streamsize sgetn( char_type* s,std::streamsize count);
      (1)
      protected:
      virtualstd::streamsize xsgetn( char_type* s,std::streamsize count);
      (2)
      1) Callsxsgetn(s, count) of the most derived class.
      2) Readscount characters from the input sequence and stores them into a character array pointed to bys. The characters are read as if by repeated calls tosbumpc(). That is, if less thancount characters are immediately available, the function callsuflow() to provide more untilTraits::eof() is returned.
      Classes derived fromstd::basic_streambuf are permitted to provide more efficient implementations of this function.

      Contents

      [edit]Parameters

      s - pointer to the beginning of a char_type array
      count - maximum number of characters to read.

      [edit]Return value

      The number of characters successfully read. If it is less thancount the input sequence has reached the end.

      [edit]Notes

      The rule about "more efficient implementations" permits bulk I/O without intermediate buffering: that's howstd::ifstream::read simply passes the pointer to the POSIXread() system call in some implementations of iostreams

      [edit]Example

      This section is incomplete
      Reason: no example

      [edit]See also

      invokesxsputn()
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/io/basic_streambuf/sgetn&oldid=128058"

      [8]ページ先頭

      ©2009-2025 Movatter.jp