1//QString to wchar_t:2constwchar_t * encodedName = reinterpret_cast<constwchar_t *>(fileName.utf16());34//QString to char * (general case):5constchar* tmp =str.toUtf8().constData();67//wchar_t* to QString8wchar_t szMsg[100] = {0};9_stprintf(szMsg,L"Connect [%s] fail...
// 注: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...
// 注: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...
转自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(); ...