把一个char数组,转换成一个string。
char *tmp1;
string tmp2;
/* read data into tmp1 */
/* tmp1 now has 1-10 megs of data in it */
temp2 = tmp2.insert(0, tmp1);
string tmp2;
/* read data into tmp1 */
/* tmp1 now has 1-10 megs of data in it */
temp2 = tmp2.insert(0, tmp1);
把一个string转换到一个char数组。
char tmp1[];
string tmp2;
string tmp2;
strncpy(tmp1,tmp2.c_str(),temp2.length());