Boost: ASIO: streambuf is defined as follows:
Namespace boost {
Namespace ASIO {
/// Typedef for the typical usage of basic_streambuf.
Typedef basic_streambuf <> streambuf;
} // Namespace ASIO
} // Namespace boost
Basic_streambuf inherits from STD: streambuf, as follows:
Class basic_streambuf
: Public STD: streambuf,
Private noncopyable
----------------------------
STD: streambuf definition:
Typedef basic_streambuf <char> streambuf;
Internally, it is saved as a character array using the vector <char> type.
PRIVATE:
STD: size_t max_size _;
STD: vector <char_type, Allocator> buffer _;
Suppose response _ Is boost: ASIO: streambuf type, available
Char C1 = Response _. sgetc (); read the first character
Char C2 = Response _. snextc (); read the second character
Char C3 = Response _. snextc (); read the third character
Char C4 = Response _. snextc ();...
Char C5 = Response _. snextc ();...
Char C6 = Response _. snextc (); read the sixth character
How to convert it into a string:
Int size = Response _. Size (); returns the number of characters remaining.
Char buffer [size + 1];
Response _. sgetn (buffer, size );
Buffer [size] = '\ 0 ';
STD: String stemp (buffer );
You can also use another method to obtain its internal string:
STD: istream response_stream (& Response _);
Poco: streamcopier: copytostring (response_stream, result );