0

I am using a Solaris server in my engineering course. Running code through SecureCRT and the gcc compiler. A task we have is to have the user input a string, and for the program to reverse it. The input string needs to show up in red, and I do not know what code manipulates colors to screen.

See Image for input /output The image of the input/output style

I tried running the code from the first link below, and it didnt output in any colors. It still shows all of the words in the standard black and white

  • See : http://stackoverflow.com/questions/3585846/color-text-in-terminal-aplications-in-unix – OlivierLi Feb 22 '13 at 18:50
  • Look to this [post](http://stackoverflow.com/questions/3274824/color-console-in-ansi-c), hope it's helpful – Houari Feb 22 '13 at 18:52
  • 1
    you should be able to write the appropriate control characters to stdout to change color (then again to change it back) \\033[1;31m is red \\033[1;39m is white – technosaurus Feb 22 '13 at 18:56

1 Answers1

3

Look into ncurses. It's a library built to handle this sort of thing, among other formatting.

start_color() in curses might be a good start.

Mr_Spock
  • 3,815
  • 6
  • 25
  • 33