Why does wide file-stream in C++ narrow written data by default?

前端 未结 5 1338
别跟我提以往
别跟我提以往 2020-11-30 05:44

Honestly, I just don\'t get the following design decision in C++ Standard library. When writing wide characters to a file, the wofstream converts wchar_t<

5条回答
  •  醉酒成梦
    2020-11-30 06:45

    I don't know about wofstream. But C++0x will include new distict character types (char16_t, char32_t) of guaranteed width and signedness (unsigned) which can be portably used for UTF-8, UTF-16 and UTF-32. In addition, there will be new string literals (u"Hello!" for an UTF-16 coded string literal, for example)

    Check out the most recent C++0x draft (N2960).

提交回复
热议问题