
-----------------------------------
jonos
Thu Feb 12, 2004 10:03 pm

changing text colours/background colours in console programs
-----------------------------------
im trying to change the text colour in a console program and i think it's something like SetTextColor and SetBkColor or something but im not sure and i don't know what header to include. does anyone know how to do this?

-----------------------------------
Paul
Thu Feb 12, 2004 11:22 pm


-----------------------------------
there ain't many tutorials in the C/C++ section, maybe someone who knows this should make some tutorials, for everyone, if not only for Jonos' sake.  On the basic stuff or something :lol:

-----------------------------------
Catalyst
Thu Feb 12, 2004 11:58 pm


-----------------------------------
i beleive that the borland compiler comes with a library and header that does thoes things

-----------------------------------
Dan
Fri Feb 13, 2004 7:50 pm


-----------------------------------
alougth it should be noted that it is unlike that it will work on all platforms....

the stantdered c or c++ complier/install dose not come with a graficks lib or comands like u whont. but there are any that can be dl online.

-----------------------------------
wtd
Fri Feb 13, 2004 10:37 pm


-----------------------------------
A curses interface may or may not get you what you need, but it can't hurt to look at the docs: http://www.cise.ufl.edu/~ppadala/ncdoc/html/ncintro/

-----------------------------------
octopi
Sat Feb 14, 2004 12:25 am


-----------------------------------
On windows, Nt strain. (maybe 9x)

0 = Black       8 = Gray
1 = Blue        9 = Light Blue
2 = Green       A = Light Green
3 = Aqua        B = Light Aqua
4 = Red         C = Light Red
5 = Purple      D = Light Purple
6 = Yellow      E = Light Yellow
7 = White       F = Bright White

color BF

Where F is the forground color, and B is the background color

color e4
Will set the color to red, and the background to yellow



Use a system command to call this. Should work. (same as you would call cls, to clear screen)

-----------------------------------
jonos
Sat Feb 14, 2004 11:44 pm


-----------------------------------
isn't that for changing the screen colors in command prompt

edit:
i think i get it now, cause system("cls"); clears the screen, system does in the program what dos would do with that command?

-----------------------------------
jonos
Sat Feb 14, 2004 11:51 pm


-----------------------------------
okay, i just did that and it worked, so even though you don't need them to show my unending gratitude for your genius i will award thee with bits.

-----------------------------------
octopi
Sun Feb 15, 2004 12:29 am


-----------------------------------
Thanks for the bits....but I'm refunding them, because my bits automatically get reset to 1000, every so often... Cause I'm a mod.

-----------------------------------
jonos
Sun Feb 15, 2004 9:17 am


-----------------------------------
yeah, thats why i said you didn't really need them, but i couldn't really do anything else, so i gave you bits.

does the system("") function only work in windows or can it be used in linux just instead using system("linux command").

also, so does that mean i could do something like system("shutdown -s -c "hehe"")?

-----------------------------------
octopi
Sun Feb 15, 2004 12:22 pm


-----------------------------------
I think you mean single qoutes.

system("shutdown -s -c 'hehe'");


and I have no clue what the -s and -c options are for (my version of shutdown doesn't have either.)
You need to be root to shutdown the system....So yes, that command would work, it it was run as root.
