I'm amazedCode:printf("\e[H\e[2J");
Can someone explain how can this clear the screen in details please?
I'm amazedCode:printf("\e[H\e[2J");
Can someone explain how can this clear the screen in details please?
Because the terminal you're using understands ANSI escape codes:
http://www.bluesock.org/~willg/dev/ansi.html
If you understand what you're doing, you're not learning anything.
Cursor Home
Sets the cursor position where subsequent text will begin. If no row/column parameters are provided (ie. \e[H), the cursor will move to the home position, at the upper left of the screen.Code:\e[{ROW};{COLUMN}H \e[H
Erase Screen
Erases the screen with the background colour and moves the cursor to home.Code:\e[2J
I found that here.
You must have never played any old DOS text / ANSI games or MUDs. Kids these days.
Quzah.
Hope is the first step on the road to disappointment.