Color Text error

Hello,
I have this code which compiles correctly but for some reason when I run the program the output is:

sh: 1: color: not found
Hello


And "Hello" is in regular text color.
I have tried googling this but nothing relevant comes up. I'm thinking that I may have to install something but I'm not too sure about that.


Here is the code:

1
2
3
4
5
6
7
8
9
10
11
#include <stdlib.h>
#include <iostream>
using namespace std;

int main() 
{
system( "color 1A" );
cout <<"Hello\n";

return(0); 
}


I am using Linux Mint 14 (based on Ubuntu 12.04) with g++ compiler.

Thanks.
Probably because color is Windows specific.

closed account (18hRX9L8)
dont use system("...");
http://www.cplusplus.com/forum/articles/11153/

use this, I use it and it works well:
http://www.cplusplus.com/articles/2ywTURfi/
Last edited on
Well that's good to know... I would think Linux would have color too.

Thanks.
The bottom link is for windows, will it work for linux?
closed account (18hRX9L8)
I have no idea, you can try it.
tried it... doesn't work. windows.h is not for linux and neither is concol.h which is in the second code.
Last edited on
ok I found how to do it
http://stackoverflow.com/questions/2616906/how-do-i-output-coloured-text-to-a-linux-terminal
when I googled it, everything was for windows but here is one for linux and it works.

Thanks for the help.
Topic archived. No new replies allowed.