clrscr in linux!
Along the lines of the previous post One command called ‘clear’, I wrote a small C program that does clrscr().
/* clrscr in linux! */
#include <stdio .h>
void clrscr(void)
{
char str[] = " [H [2J";
str[3] = str[0] = 27;
write(1, str, 7);
}
int main(int argc, char **argv)
{
clrscr();
printf("Hello World\n");
return 0;
}
Disclaimer : May not work!




Worked here.
I guess that having no clrscr shocks many people
When I started programming in Linux many years ago my first shock was not having “getch” and haskey (or something like that, a function that would tell you whether there’s a key in the buffer). Fortunately I ran into ncurses later…
Nelson Castillo
December 8, 2008
system(“clear”);
odinas
April 24, 2009