Convert Platform::String to std::string

前端 未结 2 1466
误落风尘
误落风尘 2021-01-06 07:54

I am getting String^ which Contains some Indian language characters in a callback from C# Component in my C++ WinRT Component in a Cocos2dx game for Windows Pho

2条回答
  •  無奈伤痛
    2021-01-06 08:37

    With C++, you can convert from Platform::String to std::string with the following code:

    Platform::String^ fooRT = "aoeu";
    std::wstring fooW(fooRT->Begin());
    std::string fooA(fooW.begin(), fooW.end());
    

    Reference: How to convert Platform::String to char*?

提交回复
热议问题