std::string res = "中国"; char *result = new char[res.length() + 1];for (int i = 0; i < res.length(); ++i){ result[i] = res[i]; //将string类型的res内容都放到result内}result[res.length()] = '\0'; //加上结束符
京公网安备 11010502049817号