Setting Windows Console Text Colors in C



I'm working on this project in C implementing the game N-Puzzle with a command line interface.
Started off on Linux and got to color my matrix and the numbers and all the text pretty with ANSI escape sequences.
I wanted to port the code to Windows so I can load it up in Visual Studio and finding that Windows does not support the escape sequences I did a bit of search and these two sites pretty much lay it down for you:




http://www.mailsend-online.com/blog/setting-windows-console-text-colors-in-c.html

http://cboard.cprogramming.com/cplusplus-programming/74824-setconsoletextattribute-get-int-x-how-does-work.html

"a single Windows API function...[t]he SetConsoleTextAttribute() function...via kernel32.dll"


Enjoy!




Comments