Let\'s say that on the C++ side my function takes a variable of type jstring named myString. I can convert it to an ANSI string as follows:
jstring
myString
Here is how I converted jstring to LPWSTR.
LPWSTR
const char* nativeString = env->GetStringUTFChars(javaString, 0); size_t size = strlen(nativeString) + 1; LPWSTR lpwstr = new wchar_t[size]; size_t outSize; mbstowcs_s(&outSize, lpwstr, size, nativeString, size - 1);