Archived

This topic is now archived and is closed to further replies.

Changing text color in console applications with C++

This topic is 6585 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites