admin
2022-07-08 ae66a5e07a2ebb455e83c65ded12697fd0fece98
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;
}