1
2
3
4
5
6
7
8
9
10
11
| #pragma once
| #include <tchar.h>
| #include <string>
| #include <stringapiset.h>
| std::string cstring2String(CString getbuf) {
| int iLen = WideCharToMultiByte(CP_ACP, 0, getbuf, -1, NULL, 0, NULL, NULL); //Ê×ÏȼÆËãTCHAR ³¤¶È¡£
| char* chRtn = new char[iLen * sizeof(char)]; //¶¨ÒåÒ»¸ö TCHAR ³¤¶È´óСµÄ CHAR ÀàÐÍ¡£
| WideCharToMultiByte(CP_ACP, 0, getbuf, -1, chRtn, iLen, NULL, NULL); //½«TCHAR ÀàÐ͵ÄÊý¾Ýת»»Îª CHAR ÀàÐÍ¡£
| std::string str(chRtn);
| return str;
| }
|
|