Chinaunix
标题:
如何把std::string数组,转化成为char*数组?
[打印本页]
作者:
demilich
时间:
2016-03-10 17:11
标题:
如何把std::string数组,转化成为char*数组?
本帖最后由 demilich 于 2016-03-10 17:16 编辑
我意思是:
std::string strArray[10];
转换成为
char* cStyleStrArray[10];
或者vector<std::string> 转换成 char**
作者:
linux_c_py_php
时间:
2016-03-14 10:56
分配指针数组,循环string数组,对每个字符串new出一块内存memcpy进去,存入指针数组。
作者:
boyuan0706
时间:
2016-03-15 23:34
string strResult;
const char* charResult = strResult.c_str();
char* ch = new char[strlen(charResult ) + 1];
strcpy(ch, charResult );
return ch;
string to char*
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2