Making Console output text colored in C++
|Top Tutorials||New Tutorials||Submit||Login||Register|
Total Hits: 11085
Total Votes: 130 votes
Category: C and C++/Game Programming
Submitted on: 2008-04-16 02:00:31
Submitted By: Shekhar
Description:As you can now already see, it doesn't take much effort to make colored text.
The set_color function dose all of the magic. We start off by making a output handle. Then, we set
the console text using SetConsoleTextAttribute. Its first argument is what it should change. We use
the handle that we just made to tell it that we want to edit the color of the output text. The second argument
is the number of the color you want to change to. When you call the
set_color function, we put a number of the color we want to change
the text to. Try to figure out most of the colors on your own.
All I'm gonna say is if you give the function more then a one didget
number, the background color of the text will change, too. More detail...