Quote:
Originally Posted by shogun1234
It seems the fwide(stdout, 0) always won't be 0. What should I do if I want to print wide character string to the terminal (e.g. gnome-terminal)?
|
You should be able to print wide strings using one of printf's (not wprintf) format - it should be "%S", I think, but I'm not sure, because it is different across windows/linux, so check printf man page.
I'd recommend to try wprintf without using "fwide" check and see what happens.
Side note:
Quote:
Originally Posted by shogun1234
Code:
strcpy(mbs, "This is 文件 vi 打的.");
|
I wouldn't do that.
Although you correctly set locale, there is no warranty it will be utf8 on any system where program will be run. I'd recommend to either store string as wide chars (L"This is 文件 vi 打的.") or set locale to the one required within program(for example, en_US.UTF-8) instead of system default.