What most correct way to set the encoding in C++?

前端 未结 2 1149
甜味超标
甜味超标 2020-12-11 03:52

How it is best of all to set the encoding in C++?

I got used to working with Unicode (and wchar_t, wstring, wcin, wcout<

2条回答
  •  一个人的身影
    2020-12-11 04:43

    I've just needed to output Unicode text to the console and only this function WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), ...); helped. For input I assume ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), ...); does the trick.

    PS: WriteOutput has a limit in the output string size. So you might want to iterate it in chunks if it's longer.

提交回复
热议问题