I have unsigned char*, want to convert it to std::string. Can you please tell me the safest way to do this?
unsigned char*
std::string
BYTE *str1 = "Hello World"; std::string str2((char *)str1); /* construct on the stack */
Alternatively:
std::string *str3 = new std::string((char *)str1); /* construct on the heap */ cout << &str3; delete str3;