wchar-t

Is TCHAR still relevant?

回眸只為那壹抹淺笑 提交于 2019-11-26 00:28:39
问题 I\'m new to Windows programming and after reading the Petzold book I wonder: is it still good practice to use the TCHAR type and the _T() function to declare strings or if I should just use the wchar_t and L\"\" strings in new code? I will target only Windows 2000 and up and my code will be i18n from the start up. 回答1: I would still use the TCHAR syntax if I was doing a new project today. There's not much practical difference between using it and the WCHAR syntax, and I prefer code which is

How to print Unicode character in C++?

主宰稳场 提交于 2019-11-25 19:26:49
I am trying to print a Russian "ф" ( U+0444 CYRILLIC SMALL LETTER EF) character, which is given a code of decimal 1092 . Using C++, how can I print out this character? I would have thought something along the lines of the following would work, yet... int main (){ wchar_t f = '1060'; cout << f << endl; } To represent the character you can use Universal Character Names (UCNs). The character 'ф' has the Unicode value U+0444 and so in C++ you could write it '\u0444' or '\U00000444'. Also if the source code encoding supports this character then you can just write it literally in your source code. /