>.... Now, in a member function, I need to call a native
>function that takes a std::wstring parameter. Of course, the compiler
is complaining of me trying to convert String^ to std::wstring.
What is the solution?
I use a function like this:
static void SystemStringToStdString(String ^ SystemString, wstring &
StdString)
{
IntPtr ip = Marshal::StringToHGlobalUni( SystemString );
const wchar_t * ps = static_cast<const wchar_t
*>(ip.ToPointer());
StdString = ps;
Marshal::FreeHGlobal( ip );
}
There are some built-in conversions facilities in VS2008 but when I
tried them they were less efficient that the above method.
Dave