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::sputbackc

int_type sputbackc( char_type c ); Puts back a character back to the get area. If a putback position is available in the get area (gptr() > eback()), and the character c is equal to the character one position to the left of gptr() (as determined by Traits::eq(c, gptr()[-1]), then simply decrements the next pointer (gptr()). Otherwise, calls pbackfail(Traits::to_int_type(c)) to either back up the get area or to modify both the get area and possibly the associated character sequence. T

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::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::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(

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::sbumpc

int_type sbumpc(); Reads one character and advances the input sequence by one character. If the input sequence read position is not available, returns uflow(). Otherwise returns Traits::to_int_type(*gptr()). Parameters (none). Return value The value of the character pointed to by the get pointer, or Traits::eof() if the read position is not available. Example See also sgetc reads one character from the input sequence without advancing the sequence (public member function

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