2012-11-24 40 views

回答

3

Platform::String內部使用char16,並在其構造函數中使用char16*。您需要使用MultiByteToWideCharchar*文本轉換爲char16*文本。 This question談到從Platform::Stringchar*,並從char*Platform::String應該遵循相反的路徑。

4

您可以使用mbstowcs http://www.cplusplus.com/reference/cstdlib/mbstowcs/填充wchar_t緩衝區,然後將其傳遞給Platform :: String構造函數以使用所需的數據創建實例。

static wchar_t buffer[ MAX_BUFFER ]; 
mbstowcs(buffer, source, MAX_BUFFER); 
platformString = ref new Platform::String(buffer); 
相關問題