views:

31

answers:

2

I want to make some printf's to the windows console from my C program but want to make some of them different colours.

Anyone know if this can be done easily?

EDIT: Windows XP is my OS

A: 

That's not possible in CMD (correct me if I'm wrong). You can only change the foreground and background color of CMD as a whole. Not by line, or word.

For changing its foreground and background colors please refer to the color command:

color /?

Ruel
+1  A: 

SetConsoleTextAttribute() will let you set the color of subsequent text output.

You'll probably want to look at the complete set of Win32 console APIs to be able to get/set/restore and otherwise manipulate the console.

Michael Burr
Win. Thanks Sir!
Matt