LPBYTE buffer = (LPBYTE)calloc(1024, sizeof(char));
std::string res;
I want something like:
res = buffer;
LPBYTE buffer = (LPBYTE)calloc(1024, sizeof(char));
std::string res;
I want something like:
res = buffer;
You can use the std::string constructor (number 6 in the link) that uses iterators to copy the buffer into a string:
std::string res(buffer, buffer + 1024);
Note that there is no conversion other than the unsigned char
s in your buffer
being converted to char
s in the std::string
.