| delorie.com/archives/browse.cgi | search |
| From: | kezman AT bigfoot DOT com (Kieran Farrell) |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Changeing Colour Within A String |
| Message-ID: | <369090a9.6137455@ade-news.tpg.com.au> |
| X-Newsreader: | Forte Free Agent 1.11/32.235 |
| Lines: | 34 |
| Date: | Mon, 04 Jan 1999 10:10:13 GMT |
| NNTP-Posting-Host: | 203.12.160.240 |
| X-Trace: | newsfeed.slurp.net 915445516 203.12.160.240 (Mon, 04 Jan 1999 04:25:16 CDT) |
| NNTP-Posting-Date: | Mon, 04 Jan 1999 04:25:16 CDT |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Hi guys,
I was wondering if someone could give me some ideas on how to change
text colour within a string. The easiest way is to explain what I want
is to give an example.
#include <conio.h>
int main(void)
{
sprintf( buf,"{wHello {Y There{x" );
/*********************************************************
* where {w turns the text after it white *
* where {Y turns the following text Bright Yellow *
* where {x ends the colour code *
*********************************************************/
cputs( buf );
return 0;
}
so you get a dull white hell and a bright Yellow There. the {x means
that the colour code is reset to normal for the next cputs cprintf
etc. hmm hard to explain I guess but if I leave the {x out I want the
next cputs or cprintf to be the last colour used, so in the code
example above minus the {x and after the cputs add a cprintf(
"glunk"); the glunk will be bright yellow still.
Can this be done, I have see it work on a mud and would like to use it
in my programs. I haven't access to the mud code to have a look at how
they did it. Ack sorry for rambling
Thanx in advance
Kieran Farrell
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |