CString <--> std::string
CString sString
std::string stdString;
//
stdString = (LPCTSTR)sString;
//
sString = stdString.c_str();
sString = stdString.data();
//string 转换为 char 型
char* str = strdup ( stdString.c_str() );
cout << str << endl;
char 转换为 string 型
char* str = "char 转换为 string 型";
stdString = str;
没有评论:
发表评论