In the c++ question console window, Hello appears in red...

Asked 2 years ago, Updated 2 years ago, 168 views

If I run this code, HELLO comes out in red in the console window, but why does it come out like that? Please explain in detail.

char red[] = { 0x1b, '[', '1', ';', '3', '1', 'm', 0 };
cout << red << "HELLO" << endl;

c++ char array output

2022-09-20 19:39

1 Answers

I am leaving a link because there is a well-organized content.

http://sunyzero.egloos.com/4282610

To summarize briefly, there is an ANSI code for colors. Based on the code, define the color of characters that are stamped on the console.


2022-09-20 19:39

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.