If you are under xterm
or VT100
compatible, you can make use of console codes, example:
#include
#include /* for sleep */
#define update() printf("\033[H\033[J")
#define gotoxy(x, y) printf("\033[%d;%dH", x, y)
int main(void)
{
update();
puts("Hello");
puts("Line 2");
sleep(2);
gotoxy(0, 0);
puts("Line 1");
sleep(2);
return(0);
}
You can do almost everything with escape sequences, but as pointed out in wikipedia: ncurses
optimizes screen changes, in order to reduce the latency experienced when using remote shells.