std::basic_streambuf::sputn

std::streamsize sputn( const char_type* s, std::streamsize count ); (1) protected: virtual std::streamsize xsputn( const char_type* s, std::streamsize count ); (2) 1) Calls xsputn(s, count) of the most derived class. 2) Writes count characters to the output sequence from the character array whose first element is pointed to by s. The characters are written as if by repeated calls to sputc(). Writing stops when either count characters are written or a call to sputc() would have r

std::basic_streambuf::sputc

int_type sputc( char_type ch ); Writes one character to the output sequence. If the output sequence write position is not available (the buffer is full), then calls overflow(ch). Parameters ch - character to write Return value The written character, converted to int_type with Traits::to_int_type(ch). on success. Traits::eof() (as returned by overflow()) on failure. Example #include <iostream> #include <sstream> int main() { std::ostringstream s;

std::basic_streambuf::snextc

int_type snextc(); Advances the input sequence by one character and reads one character. The function calls sbumpc() to advance the input sequence. If that function returns Traits::eof() meaning that input sequence has been exhausted and uflow() could not retrieve more data, Traits::eof() is returned. Otherwise sgetc() is called in order to read the character. Parameters (none). Return value The value of the next character. If the input sequence has been exhausted, Traits::eof() i

std::basic_streambuf::showmanyc

protected: virtual std::streamsize showmanyc(); Estimates the number of characters available for input in the associated character sequence. underflow() is guaranteed not to return Traits::eof() until at least that many characters are extracted. Parameters (none). Return value The number of characters that are certainly available in the associated character sequence, or -1 if showmanyc can determine, without blocking, that no characters are available. If showmanyc returns -1, unde

std::basic_streambuf::pubsync

int pubsync(); (1) protected: virtual int sync(); (2) Synchronizes the controlled character sequence (the buffers) with the associated character sequence. 1) Calls sync() of the most derived class. 2) The base class version of this function has no effect. The derived classes may override this function to allow synchronizing the underlying device with the buffers. For output streams, this typically results in writing the contents of the put area into the associated sequence, i.e. f

std::basic_streambuf::sgetn

std::streamsize sgetn( char_type* s, std::streamsize count ); (1) protected: virtual std::streamsize xsgetn( char_type* s, std::streamsize count ); (2) 1) Calls xsgetn(s, count) of the most derived class. 2) Reads count characters from the input sequence and stores them into a character array pointed to by s. The characters are read as if by repeated calls to sbumpc(). That is, if less than count characters are immediately available, the function calls uflow() to provide more un

std::basic_streambuf::setp

void setp( char_type* pbeg, char_type* pend ); Sets the values of the pointers defining the put area. Specifically, after the call pbase() == pbeg, pptr() == pbeg, epptr() == pend. Parameters pbeg - pointer to the new beginning of the put area pend - pointer to the new end of the put area Return value (none). Example #include <iostream> #include <array> // Buffer for std::ostream implemented by std::array template<std::size_t SIZE, class CharT =

std::basic_streambuf::setg

void setg( char_type* gbeg, char_type* gcurr, char_type* gend ); Sets the values of the pointers defining the get area. Specifically, after the call eback() == gbeg, gptr() == gcurr, egptr() == gend. Parameters gbeg - pointer to the new beginning of the get area gcurr - pointer to the new current character (get pointer) in the get area gend - pointer to the new end of the get area Return value (none). Example #include <iostream> #include <sstream&

std::basic_streambuf::pubsetbuf

basic_streambuf<CharT, Traits>* pubsetbuf( char_type* s, std::streamsize n ) (1) protected: virtual basic_streambuf<CharT, Traits>* setbuf( char_type* s, std::streamsize n ) (2) 1) Calls setbuf(s, n) of the most derived class 2) The base class version of this function has no effect. The derived classes may override this function to allow removal or replacement of the controlled character sequence (the buffer) with a user-provided array, or for any other implementatio

std::basic_streambuf::sgetc

int_type sgetc(); Reads one character from the input sequence. If the input sequence read position is not available, returns underflow(). Otherwise returns Traits::to_int_type(*gptr()). Parameters (none). Return value The value of the character pointed to by the get pointer. Example #include <iostream> #include <sstream> int main() { std::stringstream stream("Hello, world"); std::cout << "sgetc() returned '" << (char)stream.rdbuf()->sgetc(