Archived

This topic is now archived and is closed to further replies.

Text Color in C

This topic is 5584 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ive surfed the web and found that it is possible to change text color in C but it depends on system etc, does anyone know how to do that in C on Windows Me system? ive tried : printf( "\n\e[0m" ); and the compiler doesnt recognize that escape

Share this post


Link to post
Share on other sites
That escape sequence is a hold over from the days of ansi.com - that looks like a web address, but it''s a com file. You can still use it with W9x - dig around here: http://www.robvanderwoude.com/ for details. There are other ways to change the console text colors too - using the console api - visit MSDN for the details on that. One thing to note, however, is that the console api is more geared towards NT than 9x - so taking the ansi.com route might be the way to go.

Share this post


Link to post
Share on other sites
That''s ansi.sys
It comes with winME, it''s in the windows\command folder.
just add this line in your config.sys:

device=C:\windows\command\ansi.sys

Remember that the windows path in your system could be different, and that this won''t work for win2k+ (probably, can''t test it)

Other thing, in the days of DOS Borland C++, you could use cprintf and conio.h functions to setup your colors and stuff related to the console. Search around in msdn for "cprintf" and "conio.h", I think it''s supported.

Share this post


Link to post
Share on other sites