changing the console background color

Hi,
I am new to C++.

Can any one give me an example on how to change the background console color?

Thanks
C++ knows nothing of such things inherently. It depends on which console you're using, and which operating system.
Linux xterm or maybe a ncurses code example
If you are doing a "human must be present"-type, fullscreen kind of application, I recommend you to the Curses library. See here for more (plus examples of playing with color in the terminal.)
http://www.cplusplus.com/forum/general/41965/#msg226792

If you just want to leverage some simple color tricks, you should use the terminfo library and the putp() function. I cannot produce any example code for you right now (my PC's CPU fan died and so I am using my wife's non-programming PC to post here), so you'll have to read through the terminfo man page yourself.
http://linux.die.net/man/5/terminfo

And I also recommend you to the Terminfo / Termcap Terminal HOWTO
http://tldp.org/HOWTO/Text-Terminal-HOWTO-16.html

Playing with text color on *nix systems is not simple.

Hope this helps.
Topic archived. No new replies allowed.