Thread: About those text colors...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    249

    About those text colors...

    How can you make text right next to eachother different colors? With:
    Code:
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE | FOREGROUND_INTENSITY);
    you have to make a new line via endl to make a new color text, or else everything is the same color. So what if you want two words right next to eachother different colors without a new line?

  2. #2
    Registered User Dr. Bebop's Avatar
    Join Date
    Sep 2002
    Posts
    96
    You don't have to use endl, just flush the output stream and you can put it all on the same line.

    // Change the color
    cout<< "part of the text" <<flush;
    // Change the color
    cout<< "The rest of the text" <<endl;
    Processing error: Stupidity detected.
    ------------------------------
    Dr. Bebop
    Windows XP Professional Ed.
    Microsoft Visual Studio 6

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    249
    Thanks man

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DirectX | Drawing text
    By gavra in forum Game Programming
    Replies: 4
    Last Post: 06-08-2009, 12:23 AM
  2. my text adventure
    By ckeener in forum C++ Programming
    Replies: 2
    Last Post: 06-06-2005, 08:33 AM
  3. Replies: 3
    Last Post: 05-25-2005, 01:50 PM
  4. Constantly updated editable colored text
    By _Elixia_ in forum Windows Programming
    Replies: 2
    Last Post: 06-15-2003, 04:21 PM
  5. Replies: 1
    Last Post: 10-30-2002, 05:45 AM