How do I convert the contents of a Platform::String to be used by functions that expect a char* based string? I\'m assuming WinRT provides helper functions for this but I ju
You shouldn't cast a wide character to a char, you will mangle languages using more than one byte per character, e.g. Chinese. Here is the correct method.
#include
#include
Platform::String^ fooRT = "foo";
stdext::cvt::wstring_convert> convert;
std::string stringUtf8 = convert.to_bytes(fooRT->Data());
const char* rawCstring = stringUtf8.c_str();