unicode下 CString 转 string

  • Post author:
  • Post category:其他


unicode 下CString转string

CString path = L"ABC";
int n = path.GetLength();
int len = WideCharToMultiByte(CP_ACP, 0, path, path.GetLength(), NULL, 0, NULL, NULL);
char * pTest = new char[len + 1];
WideCharToMultiByte(CP_ACP, 0, path, path.GetLength(), pTest, len, NULL, NULL);
pTest[len] = '\0';
std::string s = pTest



版权声明:本文为zhangxxxxxxu原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。