I want to know: how to clean screen on an UNIX-based system? I searched on the Internet, but I\'ve just found how to do it on Windows: system(\"CLS\") I don\'t want exactly
You can achieve this using CSI sequences:
#include
int main()
{
printf("\x1b[H\x1b[J");
}
\x1b[H
?Actually it is the same as \x1b[1;1;H
, it means that it will move the cursor to row 1 and column 1.
\x1b[J
a.k.a \x1b[0;J
?If n is 0 or missing, it will clear from cursor to end of screen.
Source: https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_sequences