linux gcc 4.4.1
I have the following fprintf statement and I would like to have the OK as green and the FAILED as red. Is this possible?
if(devh == -1)
{
fprintf(stderr, "Device [ FAILED ]\n");
}
else
{
fprintf(stderr, "Device [ OK ]\n");
}
Many thanks for any suggestions,
You should probably use some library such as ncurses to handle terminal.
Alternatively, under Linux you could use some console escape sequences such as:
(in this case 32 stands for green), but it is neither portable nor elegant.