I have a pointer to a const *char
buffer as well as it's length, and am trying to use an API (in this case, the AWS S3 C++ upload request) that accepts an object of type:
std::basic_iostream <char, std::char_traits <char>>
Is there a simple standard C++11 way to convert my buffer into a compatible stream, preferably without actually copying over the memory?
I have a pointer to a const *char buffer
do you really mean that you have a pointer to aconst char* buffer[N]
, or did you intend to say that you have a pointer to a (zero terminated?) buffer of characters? – Yardmanstd::strstream
can do that, but it's deprecated. The non-deprecated counterpart isstd::stringstream
, but it can't work off a client-provided buffer - it always makes a copy. – Fides