How do I put colored text to the screen without using printf()? C++ does not support it.
Borland 5.1 answer please
---------------------------
Engineer223
yoshi!
How do I put colored text to the screen without using printf()? C++ does not support it.
Borland 5.1 answer please
---------------------------
Engineer223
yoshi!
Last edited by Yoshi; 11-22-2001 at 06:56 PM.
Yoshi
Look up conio.h with a text editor. You'll find several #define statements in the middle of the file defining colors 1-15 (the DOS colors - I'm assuming you're doing DOS programming) with names like #define CYAN 3, etc....
Most C++ runtime library i/o systems should support this in some way or another, most likely through a function parameter.
__________________________________________________
Sean Mackrory
[email protected]
I thought your Dominion was crushed by Kerrigan, so you're only a "former Emperor".Originally posted by Engineer223
Engineer223
A.K.A. Arcturus Mengsk, Emperor of the Terran Dominion
However, you're the reason she is what she is, so I don't feel sorry for ya . Have a good one...
the Fenix of Antioch
(Did someone tell you that I fell in battle? Naah!)
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
C++ does support it. and the windows version works better than the conio version.
simple code to output colored text.
#include <windows.h> // always include this it helps.
void Gcoloredtext()
{
HANDLE hStdout;
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
int G = 128;
SetConsoleTextAttribute(hStdout, G); // blue bg, white text
printf("Blue Background with White text");
int R = 7;
SetConsoleTextAttribute(hStdout, R); // reset to grey.
};
c++->visualc++->directx->opengl->c++;
(it should be realized my posts are all in a light hearted manner. And should not be taken offense to.)
I found it, it was cprintf();
Thanks for everyone's help
Yoshi