vendredi 28 août 2015

C++ Macro wrapper for std::cout

I want to print values to terminal in c++ using different color scheme. For example to print Hello World in red I write the following code

std::cout<< "\033[31mHello World \033[0m" << std::endl;

Repeating this syntax for all the std::cout is not the best way. I want to make a Macro PRINT_RED() that wraps the above cout. However my macro just doesnt work. Can I get a hint on this!

Aucun commentaire:

Enregistrer un commentaire