c++中string转为char数组

string str1 = "abcdefgh";
char str2[20];
strcpy(str2,str1.c_str());//用到 c_str()函数

猜你喜欢

转载自blog.csdn.net/yueguangmuyu/article/details/111594393