inserting coloured text into program code

how to insert coloured text into program code

Page 1 of 1

3 Replies - 600 Views - Last Post: 23 February 2010 - 12:11 AM Rate Topic: -----

#1 Guest_Odane*


Reputation:

inserting coloured text into program code

Posted 22 February 2010 - 08:43 PM

can anyone assist me plz
Is This A Good Question/Topic? 0

Replies To: inserting coloured text into program code

#2 eker676  Icon User is offline

  • Software Engineer
  • member icon

Reputation: 378
  • View blog
  • Posts: 1,833
  • Joined: 18-April 09

Re: inserting coloured text into program code

Posted 22 February 2010 - 09:08 PM

Here's something I found after a quick google search. There is a snippet around here somewhere as well.

#include <windows.h>
#include <iostream.h>
 
int main()
{
   SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0); //replace the 0 with a number for the color you want
 
   cout << "Your text here" << endl;
 
   return 0;
}

Was This Post Helpful? 0
  • +
  • -

#3 taylorc8  Icon User is offline

  • B&

Reputation: 149
  • View blog
  • Posts: 1,572
  • Joined: 21-July 09

Re: inserting coloured text into program code

Posted 22 February 2010 - 11:06 PM

I've seen the code on some 20 year old page on microsoft.com a while back on how to do it, and it's a little more involved than that snippet there... I do have it around somewhere, but wouldn't a google search be easier, or even microsoft.com search?
Was This Post Helpful? 0
  • +
  • -

#4 Martyn.Rae  Icon User is offline

  • The programming dinosaur
  • member icon

Reputation: 540
  • View blog
  • Posts: 1,406
  • Joined: 22-August 09

Re: inserting coloured text into program code

Posted 23 February 2010 - 12:11 AM

You can use the MSDN reference found here.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1