我想将一个普通的
这是我做的事情:
string
转换成 wstring
。为此,我试图使用 Windows API 函数 MultiByteToWideChar
。但是它对我不起作用。这是我做的事情:
string x = "This is c++ not java";
wstring Wstring;
MultiByteToWideChar( CP_UTF8 , 0 , x.c_str() , x.size() , &Wstring , 0 );
最后一行代码会产生编译错误:'MultiByteToWideChar' : cannot convert parameter 5 from 'std::wstring *' to 'LPWSTR'
如何修复这个错误?
另外,参数cchWideChar
的值应该是多少?0可以吗?
std::wstring
的指针传递给此函数。 - Cat Plus Plus