🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
Changing text color in console applications with C++
Can anyone tell me how to change the text color in an MS-DOS type console window? I am running it under windows 98. I am using metrowerks codewarrior, which does not seem to like conio.h (causes a link error). At first I tried to use conio.h, but as I said just a second ago, it caused a link error. Then I tried to use the system() function to use the ANSI escape color codes from the MS-DOS prompt, only to find out that the Metrowerks Standard Library files have a system() function that doesn't do anything, and always returns 0! Please help!
You can use
textcolor(x)
Where x is a number 0 - 15, and if you add 128 to x you can make it blink.
textcolor() is defined in the conio.h file, and you also have to make sure you use a writing function that supports the textcolor feature. cprintf() is one of them, which is basically the same thing as printf.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement