我将 stringstream 的字符串转换为 char 指针,但它写入空字符串。为什么会失败?
std::stringstream ss;
ss << "de12mu";
char* msg = (char*)ss.str().c_str();
std::cout << "msg: " << msg << " " << strlen(msg) << std::endl;
我将 stringstream 的字符串转换为 char 指针,但它写入空字符串。为什么会失败?
std::stringstream ss;
ss << "de12mu";
char* msg = (char*)ss.str().c_str();
std::cout << "msg: " << msg << " " << strlen(msg) << std::endl;