I want to convert a normal string to a wstring. For this, I am trying to use the Windows API function MultiByteToWideChar. But it does not work for me.

Here is what I have done:

string x = "This is c++ not java";
wstring Wstring;
MultiByteToWideChar( CP_UTF8 , 0 , x.c_str() , x.size() , &Wstring , 0 ); 

The last line produces the compiler error:

'MultiByteToWideChar' : cannot convert parameter 5 from 'std::wstring *' to 'LPWSTR'

How do I fix this error?

Also, what should be the value of the argument cchWideChar? Is 0 okay?

Edit
Report