KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I read about ANSI-C escape codes here . Tried to use it in C/C++ printf / std::cout to colorize the text outputted to console, but without success. My attempt: #include <iostream> #include <cstdio> int main() { int a=3, b=5; int &ref = a; ref = b; //cout << "\155\32\m" << a << b <<'\n'; //here it prints m→m 5, no colored text printf("\155\32\m %d",a); //here to it prints same - m→m 5, getchar(); } How can I use these escape codes to output colored text to console? Am I missing something? Also, I remember that in some C++ code I saw a call to this function textcolor(10); But it gives compilation errors in g++ and in Visual Studio. Which compiler had this function available? Any details?
Tags (comma-separated)
Save Edits
Cancel