On this page it gives example that to clean the terminal screen I can use printf with \e[1;1H\e[2J
https://stackoverflow.com/a/42500322/4808760
This is the code given there
#ifdef _WIN32
#include <conio.h>
#else
#include <stdio.h>
#define clrscr() printf("\e[1;1H\e[2J")
#endif
I don't understand what is "\e[1;1H\e[2J". Is this whole new thing or just another way of doing format specifier for printf and scanf (can I use it with scanf too)?
What is \e
, [1
, ;
,1H
, \e
and [2J
in above string feed for printf
in clrscr()
macro?
And if I have this code:
int main(){
printf("Buffered 1\n");
printf("Buffered 2\n");
printf("Buffered 3\n");
clrscr();// Prints to screen
return 0;
}
output:
user:
The problem is with the code in this question clrscr()
is that it removes everything from screen. What if I like to remove only printf text Buffered 1\n
and Buffered 3\n
or whichever possible text from terminal screen. I have also seen in output of programs install in Linux with terminal text. I am using Ubuntu.