
1 #include <regex> 2 #include <iostream> 3 #include <string> 4 #include <atlstr.h> 5 6 static std::string U2A(CString cstring) 7 { 8 if (::IsBadStringPtrW(cstring,-1)) 9 return ""; 10 11 int cchStr = ::WideCharToMultiByte(CP_UTF8, 0, cstring, -1, NULL, 0, NULL, NULL); 12 char* pstr = new char[cchStr + 1]; 13 if(pstr != NULL) 14 ::WideCharToMultiByte(CP_UTF8, 0, cstring, -1, pstr, cchStr, NULL, NULL); 15 16 pstr[cchStr] = '