u16string and char16_t in Android NDK

久未见 提交于 2019-12-23 03:52:03

问题


I wish to create (std::getline()) and manipulate UTF-16 strings in the Android NDK, so that I can pass them (relatively) painlessly back to Java for display. Currently, I'm using C++0x, using the LOCAL_CPPFLAGS := -std=c++0x switch, which works (I'm using some other 0x functions). Seems the compiler can't find u16string. I've included <string>, and get no other errors. I wish to do something such as:


ifstream file(fileName);
if(!file.is_open()) {
    return false;
}
while(!file.eof()) {
    u16string fileLine;
    std::getline(file, fileLine);

    // Do stuff with fileLine
}
return true;

Does the NDK include an out-of-date version of GCC or something? What should I do?


回答1:


The NDK does not (at least not officially) support wide characters, UTF-16 or anything like that. Nor does it provide a proper C++ library.



来源:https://stackoverflow.com/questions/5564780/u16string-and-char16-t-in-android-ndk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!