GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 10-Oct-2005, 11:51
kobi_hikri's Avatar
kobi_hikri kobi_hikri is offline
Regular Member
 
Join Date: Apr 2005
Location: Israel
Posts: 431
kobi_hikri has a spectacular aura aboutkobi_hikri has a spectacular aura about

Printing colorful characters to the console


Hey guys,

How do I print colorful string to the console ?
Would like to implement a cprintf function (for my OS project) that will print its arguments to the console with the desired colors.

Example usage will be :
CPP / C++ / C Code:
cprintf ("Red : RED%d, Yellow : YELLOW%s",some_number,some_string);

I will parse the arguments somehow, not sure it will be "RED","YELLOW" but probably "R12G10B0" to represent the RGB values.

Now, obviously, an ansi-c solution is preferable ... though I'm not sure such exists.
suggestions ?

Kobi Hikri.
__________________
It's actually a one time thing (it just happens alot).
  #2  
Old 10-Oct-2005, 12:39
Paramesh's Avatar
Paramesh Paramesh is offline
Regular Member
 
Join Date: Sep 2005
Location: The Milky Way
Posts: 927
Paramesh is a jewel in the roughParamesh is a jewel in the roughParamesh is a jewel in the rough

Re: Printing colorful characters to the console


Hi kobi,

If you use linux gcc, then take a look at this:
Colors in ANSI C using escape sequences

Just to give you some information i found.

Paramesh.
__________________

Don't walk in front of me, I may not follow.
Don't walk behind me, I may not lead.
Just walk beside me and be my friend.
  #3  
Old 10-Oct-2005, 13:21
kobi_hikri's Avatar
kobi_hikri kobi_hikri is offline
Regular Member
 
Join Date: Apr 2005
Location: Israel
Posts: 431
kobi_hikri has a spectacular aura aboutkobi_hikri has a spectacular aura about

Re: Printing colorful characters to the console


Quote:
Originally Posted by Paramesh
Hi kobi,

If you use linux gcc, then take a look at this:
Colors in ANSI C using escape sequences

Just to give you some information i found.

Paramesh.

Thank's Paramesh.
I'll look into that information, though I'm not using linux gcc I might get some pointers there.

Kobi Hikri.
__________________
It's actually a one time thing (it just happens alot).
  #4  
Old 10-Oct-2005, 14:28
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,791
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Printing colorful characters to the console


Quote:
Originally Posted by kobi_hikri
I'm not using linux gcc

Kobi Hikri.

I was blown away the first time I saw this tutorial site: (The colorful stuff starts in part 4.) Win32 Console Applications

You might want to check it out.

Regards,

Dave
  #5  
Old 10-Oct-2005, 14:47
kobi_hikri's Avatar
kobi_hikri kobi_hikri is offline
Regular Member
 
Join Date: Apr 2005
Location: Israel
Posts: 431
kobi_hikri has a spectacular aura aboutkobi_hikri has a spectacular aura about

Re: Printing colorful characters to the console


Quote:
Originally Posted by davekw7x
I was blown away the first time I saw this tutorial site: (The colorful stuff starts in part 4.) Win32 Console Applications

You might want to check it out.

Regards,

Dave

I will check it out (print it out and take it to work )

Thanks,
Kobi.
__________________
It's actually a one time thing (it just happens alot).
 
 

Recent GIDBlogWriting a book by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Things to Avoid in C/C++ -- gets() , Part 1 WaltP C Programming Language 5 21-Jun-2007 13:13
redirect char input console amad1337 C Programming Language 7 25-Jul-2005 23:00
fast characters in console svhb C Programming Language 10 22-Jun-2005 08:13
Can you change the background colors in a console app? swashplate C++ Forum 3 07-Dec-2004 21:19

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 05:46.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.