1 //QString to wchar_t: 2 const wchar_t * encodedName = reinterpret_cast<const wchar_t *>(fileName.utf16()); 3 4 //QString to char * (general case): 5 const char * tmp = str.toUtf8().constData(); 6 7 //wchar_t* to QString 8 wchar_t szMsg[100] = {0}; 9 _stpri...
// 注:wchar_t* 转换 string pWideChar = new wchar_t[str.length()]; swprintf( pWideChar, L"%s", str.c_str()); wprintf( L"%s\n", pWideChar ); // 注:string 转换 char* pChar = const_cast<char*>(str.c_str()); cout << pChar << endl; // 注:char* 转换 string str = std...
[cpp]view plain copy //QString to wchar_t: const wchar_t * encodedName = reinterpret_cast<const wchar_t *>(fileName.utf16()); //QString to char * (general case): const char * tmp = str.toUtf8().constData(); //wchar_t* to QString wchar_t szM...
转自http://hi.baidu.com/zj41342626/blog/item/3650cd82a381e9b00cf4d2c9.html //QString to wchar_t: constwchar_t * encodedName =reinterpret_cast<constwchar_t *>(fileName.utf16()); //QString to char * (general case): constchar * tmp = str.toUtf8().constData(); ...
wchar_t*,wchar_t,wchat_t数组,char,char*,char数组,std::string,std::wstring,CString... #include <string> // 使用CString必须使用MFC,并且不可包含<windows.h> #define _AFXDLL #include <afx.h> using namespace std; //--- //将 单字节char* 转换为 宽字节 wchar* inline wchar_t* AnsiToUni...