   changine text color in console mode
  How do I change the text color?I am using dev-cpp and making a console programe and I just want to change the color of the text and background color.and how would I clear the screen with having to print a lot new lines void menu(void){   std::cout << "|---------------------------------------------|"<<std::endl;   std::cout << "|=============================================|"<<std::endl;   std::cout << "| A Dos Program simulator |" << std::endl;   std::cout << "|---------------------------------------------|"<<std::endl;   std::cout << "| INTRO TO DOS SIM............................|"<<std::endl;   std::cout << "| This will be for trouble shooting computers |" << std::endl;   std::cout << "| Debug Sim|" << std::endl;   std::cout << "| FDISK SIM|"<< std::endl;   std::cout << "| Format sim    |" << std::endl;   std::cout << "| Help|" << std::endl;   std::cout << "| What do you want to do? |" << std::endl;   std::cout << "|=============================================|"<<std::endl;   std::cout << "|<<<<<<<<<Programed By Jeremy King >>>>>>>>>>>|"<<std::endl;   std::cout << "|---------------------------------------------|"<<std::endl;}I Want to put color for my menu. How could that be done?and what is wrong here it just exits my program. I am just trying to make a clear screen function    char clrscreen(){std::cout <<"\n"<<"\n";menuinput();}[edited by - kingpinzs on February 15, 2004 11:45:24 PM]
  For colour, you'll want to use ANSI colour.Colour codes:0 = reset31 = red foreground32 = yellow fg33 = blue fg34 = green fg35 = magenta fg36 = cyan fg37 = white fg41 = red backgroundand so on for 4x, the same as 3x.You can easily do this by doing a printf command:printf("\033[%im",colour);    Where colour is an integer according to the table above. So to do a red foreground text thingie, you'd go:printf("\033[31    m");    and then printf as normal. Edit:   Ignore the spaces before 'm' and after '31', it appears to be some bug in the forum software.I wrote a little header file to show what I mean here.   Resist everyoneI am your only friend. Click here for more information. (MOVED) [edited by - ravuya on February 15, 2004 12:35:12 AM] [edited by - ravuya on February 15, 2004 12:35:58 AM];  I am not sure how to use that.How would I put that in a cout statement.can you give me a example statement.examplestd::cout << ("|---------------|",37); [edited by - kingpinzs on February 16, 2004 1:44:45 AM];  Hi.  If you are using dos, you can use the color command.This is done by calling system("color f1").  The f1 is just an example.Here is the syntax of the color command: c:\>color /?Sets the default console foreground and background colors.COLOR [attr]  attr   Specifies color attribute of console outputColor attributes are specified by TWO hex digits -- the firstcorresponds to the background; the second the foreground.  Each digit can be any of the following values:    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 WhiteIf no argument is given, this command restores the color to what it was when CMD.EXE started.  This value either comes from the current console window, the /T command line switch or from the DefaultColor registry value. So if you wanted blue text on a gray background, you would do:system("color 81");std::cout << "Your text";Hope that helps.   edit:Oops.  Actually I think this command might only work in never versions of windows.  But I'm not positive.   [edited by - Rayno on February 16, 2004 3:09:41 AM]