I am calling a C++ method which returns LPWSTR (the string contains a filepath), but I need to convert this to a LPSTR to continue.
I never used C++ before and even though the different string types are explained in detail here: http://www.codeproject.com/Articles/76252/What-are-TCHAR-WCHAR-LPSTR-LPWSTR-LPCTSTR-etc, I got confused.
When I cast LPWSTR to LPTSTR (which should equal LPSTR in my app), I get exactly one Unicode Symbol. While I guess that casting isn't appropriate in this case, I don't understand why it returns only one character instead of interpreting all the 2-byte-characters of the LPWSTR somehow as 1-byte-characters. I found references to the WideCharToMultiByte function, which apparently can convert LPWSTR to std::string, which I in turn can not cast to LPSTR either.
So is there an somewhat easy way to obtain an LPSTR from the LPWSTR?