TCHAR 转换 string

来源:互联网 发布:华为大数据集群 编辑:程序博客网 时间:2024/05/03 20:00
#include <iostream>#include <string>using namespace std;//////////////////////////////////////////////////(UNICODE 环境)std::string TCHAR2STRING(TCHAR *STR){int iLen = WideCharToMultiByte(CP_ACP, 0,STR, -1, NULL, 0, NULL, NULL);char* chRtn =new char[iLen*sizeof(char)];WideCharToMultiByte(CP_ACP, 0, STR, -1, chRtn, iLen, NULL, NULL);std::string str(chRtn);return str;}

0 0
原创粉丝点击