When I try to set my console’s title to a string that has unicode characters in it, using SetConsoleTitle(), the title displays just some garbage characters instead.
I have also tried the SetConsoleTitleW() function, but that gives me the following error:
error: cannot convert 'const char*' to 'const WCHAR*' for argument '1' to 'BOOL SetConsoleTitleW(const WCHAR*)'
Any advice?
You have to use wide string literal, that is:
The
L, before a quote denotes, that this is awchar_t*string.Also, for completness I have to say, that in C++11, there are new string literal prefixes defined:
as usual wikipedia has more detailed note about that.