I have code that provides me with a pointer to a buffer and the size of the buffer that I need to fill with data. I present this buffer with an instance of boost::asio::mutable_buffer , but how do I use this buffer correctly (for example, write a string to it, ...) and increase the strength of the buffer boundaries?
Here is some pseudo code:
size_t some_callback(void *ptr, size_t) { // this function is called by 3rd party return our_handler(boost::asio::mutable_buffer(ptr, size)); } size_t our_handler(const boost::asio::mutable_buffer &buffer) { const std::string test("test"); // How do I write this string into my buffer? return test.size(); }
source share