A simple program that demonstrates one way to clear the screen using ANSI/VT100 terminal control escape sequences

clear.c:

#include <stdio.h>
int
main(){
printf("\x1b[2J\x1b[H");
return 0;
}

(ESC)[2J = Erase screen and set cursor to home

(ESC)[H = return cursor to home (seems redundant but is necessary for some VT’s)