對不起,這個業餘問題,我想在一個unicode字符串中進行一些搜索和比較。unicode或任何其他編碼數據如何存儲在內存中? (win32)
我感到有點困惑unicode-16
/wchar_t
,在Windows操作系統中,這是否存儲方式爲uint16
數組一樣嗎?
我是說如果我可以用這種方式沒有任何麻煩?
wchar_t a[100];
somefunction((uint16 *)a);
//treat a as an array of uint16 data and do something with it.
在Windows上,是的。如果你想更便攜,請查看'std :: wstring_convert':http://en.cppreference.com/w/cpp/locale/wstring_convert – aschepler