Author |
Message |
jonos

|
Posted: Thu Feb 12, 2004 10:03 pm Post subject: 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? |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Paul

|
Posted: Thu Feb 12, 2004 11:22 pm Post subject: (No subject) |
|
|
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  |
|
|
|
|
 |
Catalyst

|
Posted: Thu Feb 12, 2004 11:58 pm Post subject: (No subject) |
|
|
i beleive that the borland compiler comes with a library and header that does thoes things |
|
|
|
|
 |
Dan

|
Posted: Fri Feb 13, 2004 7:50 pm Post subject: (No subject) |
|
|
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. |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
 |
wtd
|
|
|
|
 |
octopi

|
Posted: Sat Feb 14, 2004 12:25 am Post subject: (No subject) |
|
|
On windows, Nt strain. (maybe 9x)
code: | 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 |
Where F is the forground color, and B is the background color
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

|
Posted: Sat Feb 14, 2004 11:44 pm Post subject: (No subject) |
|
|
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

|
Posted: Sat Feb 14, 2004 11:51 pm Post subject: (No subject) |
|
|
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. |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
octopi

|
Posted: Sun Feb 15, 2004 12:29 am Post subject: (No subject) |
|
|
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

|
Posted: Sun Feb 15, 2004 9:17 am Post subject: (No subject) |
|
|
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

|
Posted: Sun Feb 15, 2004 12:22 pm Post subject: (No subject) |
|
|
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. |
|
|
|
|
 |
|