Recently I'm messing around with colors in the terminal.
I'm using a sample program from
Below is the exact same program, but in cmd.exe
in which you can't see the colors.
In the same exact console however, when I run the command gcc
I do get additional colors (white and red, in fact):
Now my question is, what does gcc
do differently, to still be able to print colored text? I can't find any other way to get colored text on the console than written on the linked site above.
CodePudding user response:
Use the SetConsoleTextAttribute()
API