cstring 转 string

来源:互联网 发布:海关出口数据怎么查 编辑:程序博客网 时间:2024/05/17 15:40

如果是unicode工程
USES_CONVERSION;
CString str1;
std::string str2(W2A(str1));
如果是多字节工程
CString str1;
std::string str2(str1.Getbuffer());
str1.ReleaseBuffer();

 

error C2065: “_lpw”: 未声明的标识

error C2065: “_lpw”: 未声明的标识符
error C2065: “_convert”: 未声明的标识符
error C2065: “_acp”: 未声明的标识符
原因:在将CString转换成char*时,用T2A,没有在前添加
 USES_CONVERSION; 

 

原创粉丝点击