C++使用printf输出string类

string里有c_str()函数用于string转char数组。

使用方法为

string str;
printf("%s",str.c_str());

 

posted @ 2020-09-01 11:59  kalice  阅读(5134)  评论(0)    收藏  举报