printf data type specifier complex question

Asutosh Rath
printf("\e[2J\e[0;0H");

What does this line mean?

Can I know what to learn and from where to understand this statement?

chux - Reinstate Monica

"\e" as an escape sequence is not part of the C standard.

A number of compilers treat the otherwise undefined behavior as a character with the value of 27 - the ASCII escape character.

Alternative well defined code:

//printf("\e[2J\e[0;0H");
printf("\x1B[2J\x1b[0;0H");
printf("\033[2J\033[0;0H");
#define ESC "\033"
printf(ESC "[2J" ESC "[0;0H");

The escape character introduces ANSI escape sequences as well answered in @Mickael B.. Select terminals implement some of these sequences.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related