Как делают я преобразовываю повышение:: asio:: streambuf в станд.:: строка? [дубликат]

6
задан Matt 14 December 2009 в 08:53
поделиться

2 ответа

Did not try this, but if I read the docs correctly, this class inherits from std::streambuf, in which case you can do this:

std::istream buffer( my_asio_streambuf_ptr );
std::stringstream string_buffer;

string_buffer >> buffer.rd_buf();

There are many ways to do this, and each has it's pros and cons. If you could explain you problem in more detail, we can offer more specific help.

1
ответ дан 17 December 2019 в 02:29
поделиться

Возможно, вам нужно что-то вроде этого:

boost::asio::streambuf myBuffer;
std::string myString;  

// Convert streambuf to std::string  
std::istream(&myBuffer) >> myString;  
-1
ответ дан 17 December 2019 в 02:29
поделиться
Другие вопросы по тегам:

Похожие вопросы: