Reputation: 63
I'am not a VC++ Dev but I'am searching to EDIT a source code. I want simply add new line on my Console with Different color (Green, Red ...)
void main()
{
static char * DES_KEY = "!_a^Rc*|#][Ych$~'(M _!d4aUo^%${T!~}h*&X%";
XStrDESUtil desUtil(DES_KEY);
printf("Password: %s\n", desUtil.Decrypt("1a6a2dfd3e44b8a0b02a2b66c801821e").c_str());
system("PAUSE");
}
I've searched but all what I found is
printf ("\033[34;01mBonjour\033[00m\n");
and those characters ... but it doesn't work for some reasons :(
Upvotes: 0
Views: 292
Reputation: 16318
In Windows, you can use the Windows Console Functions for this, such as SetConsoleTextAttribute.
I have created a small free C++ template library (one header only) to wrap many of that functionality. Available at http://cppconlib.codeplex.com/.
Upvotes: 1
Reputation: 3660
Check out this header-only library that works for both, ANSI and Windows consoles:
https://github.com/tapio/rlutil
rlutil::setColor(rlutil::GREEN);
rlutil::setColor(rlutil::RED);
should suffice
Upvotes: 1