Is it possible to set text colors in c, and if so how can I do it?
-Thanks Much-
Is it possible to set text colors in c, and if so how can I do it?
-Thanks Much-
There is no ANSI standard to display colored text. This is implementation specific and will be different based on your compiler and operating system combination.
Quzah.
Hope is the first step on the road to disappointment.
#include <conio.h> /*Contains text colors */
main()
{
textcolor( BLUE ); /*change text color to blue */
cprintf("Hello World"); /*Will print out Hello world in blue*/
textbackground( GREEN ); /*background color is green*/
textcolor( RED ); /*change text to red*/
cprintf("\nHello Again");/*Will have a background green and color of red*/
}
Edit the header file conio.h to see what colors you can choose.
At least you didn't use void main, but all of those functions are nonstandard and I have yet to see a non-Borland compiler have textcolor or textbackground. Believe me when I say that nonstandard should be avoided when possible and used only when necessary.Code:main() { textcolor( BLUE ); /*change text color to blue */ cprintf("Hello World"); /*Will print out Hello world in blue*/ textbackground( GREEN ); /*background color is green*/ textcolor( RED ); /*change text to red*/ cprintf("\nHello Again");/*Will have a background green and color of red*/ }
-Prelude
My best code is written with the delete key.
Is there any function in VC++ 6.0 (on Win98) for changing text color?
Current projects:
1) User Interface Development Kit (C++)
2) HTML SDK (C++)
3) Classes (C++)
4) INI Editor (Delphi)
Oh boy, there must be hundreds of threads about this, probably thousands.
I posted some code the other day, HERE
All spelling mistakes, syntatical errors and stupid comments are intentional.
Sorry for the stupid question and thank you for your answer.
Current projects:
1) User Interface Development Kit (C++)
2) HTML SDK (C++)
3) Classes (C++)
4) INI Editor (Delphi)