C++使用printf输出string类

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

使用方法为

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