Thread: Text Color

  1. #1

    Text Color

    Hello! I'm programming this console program and I need some help.

    Using MSVC++, how do I color cout output? I tried the conio.h function but it doesn't work, and the Microsoft one doesn't work either. Can anyone help?
    What will people say if they hear that I'm a Jesus freak?
    What will people do if they find that it's true?
    I don't really care if they label me a Jesus freak, there is no disguising the truth!

    Jesus Freak, D.C. Talk

    -gnu-ehacks

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    Hi There,

    From what i gather, you can't do it using 'cout'. You have to use the platform specific functions for Windows.

    Take a look at SetConsoleTextAttribute(), SetConsoleTitle() and SetConsoleWindowInfo() for info on how to set attributes of a console application. You will have to use the WriteConsole() and ReadConsole() functions to be able to output in colour.

    There are a variety of GetConsole* methods too.... you might find them handy!

    Good luck!
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GUI Text Color Problem
    By justlivelife15 in forum Windows Programming
    Replies: 3
    Last Post: 06-25-2007, 05:47 AM
  2. Change text color in C
    By IndioDoido in forum C Programming
    Replies: 9
    Last Post: 04-15-2007, 05:54 AM
  3. Critique my lighting model.
    By psychopath in forum Game Programming
    Replies: 4
    Last Post: 08-12-2006, 06:23 PM
  4. Color text from windows.h?
    By Saintdog in forum C++ Programming
    Replies: 10
    Last Post: 12-03-2004, 09:20 AM
  5. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM