Unicode

how do i print out a Unicode check mark in console...I can print one out in linux using the line cout <<"\033[32m\xE2\x9C\x93\033[0m<<endl; but it wont work on windows console...
A unicode checkmark would look like an ascii checkmark. And I don't even know what a check mark looks like. I see a 33 in your code. Decimal 33 is an exclamation mark. But this'll print to console a unicode upper case 'A'...

1
2
3
4
5
6
7
8
9
#include <stdio.h>

int main()
{
 wprintf(L"%c\n",65);
 getchar();

 return 0;
}
thanks worked great. the check mark is 251....how do i get it to print the check mark in green color?
There are piles of (couple dozen) console specific Windows Api Functions. One of them is used to set the color. I need to look it up. Be back in a minute....

...looks like....

FillConsoleOutputAttribute()

Here is a cls() function that uses it....

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
void cls()
{
 CONSOLE_SCREEN_BUFFER_INFO csbi;
 COORD coordScreen = {0,0};
 DWORD cCharsWritten;
 HANDLE hStdOutput;
 DWORD dwConSize;
 
 hStdOutput=GetStdHandle(STD_OUTPUT_HANDLE);
 GetConsoleScreenBufferInfo(hStdOutput, &csbi);
 dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
 FillConsoleOutputCharacter(hStdOutput,(TCHAR)' ',dwConSize,coordScreen,&cCharsWritten);
 GetConsoleScreenBufferInfo(hStdOutput,&csbi);
 FillConsoleOutputAttribute(hStdOutput,csbi.wAttributes,dwConSize, coordScreen,&cCharsWritten);
 SetConsoleCursorPosition(hStdOutput,coordScreen);
}


If you are into console mode programming in Windows you might e interested in this thread...


http://cboard.cprogramming.com/windows-programming/169351-setconsolectrlhandler.html

Last edited on
closed account (E0p9LyTq)
@Thomas1965,

That Code Project is VERY helpful to me. Using C++ standard overloading to make the Win32 manipulation as seamless as possible. Thank you so much for posting the link.

I had been using another method, http://www.cplusplus.com/articles/Eyhv0pDG/. What you linked is IMO better.
Topic archived. No new replies allowed.