char* Tchar* wxString相互转换

char*->TCHAR*
       char *ansii_string = "some text";
       int size = strlen(ansii_string);
       TCHAR unicode_string[30];
       mbstowcs(unicode_string, ansii_string, size+1);

wxString->TCHAR*
       wxString wx_string=_T("wx string");
       TCHAR wchar_string[30];
       wcscpy(wchar_string,wx_string.wc_str());

wxString->char*
       wxString wx_string=_T("wx string");
       char ansi_string[30];
       strcpy(ansi_string,wx_string.mb_str());

TCHAR*->char*
       TCHAR* unicode_string=_T("unicode string");
       int size= wcslen(unicode_string);
       char ansi_string[30];
       wcstombs(ansi_string, unicode_string, size+1);

TCHAR*->wxString
       TCHAR *tchar_string = _T("some text");
       wxString wx_string(tchar_string,wxConvUTF8);

char*->wxString
       char *ansii_string = "some text";
       wxString wx_string(ansii_string,wxConvUTF8);

你可能感兴趣的:(String)