#include <string>
#include <iostream>
#include <stdio.h>

using namespace std;

int main()
{
string strOutput = "Hello World";

cout << "[cout] strOutput is: " << strOutput << endl;

// string 转换为 char*
const char* pszOutput = strOutput.c_str();

printf("[printf] strOutput is: %s\n", pszOutput);


string sstr1(strOutput);

cout << "sstr1= " << sstr1<< endl;


return 0;
}
[cout] strOutput is: Hello World
[printf] strOutput is: Hello World
sstr1= Hello World