c++ - Clean the screen in C -


this question has answer here:

i want clean console screen every 2 seconds, tried use following command:system("clear"); doesn't clear screen. eclipse not recognized file "conio.h" clrscr() function. i'm using ubuntu os. suggestions?

this has been answered before: how clear console screen in c?

basically, it's not cross-platform. if you're using ubuntu, line should work:

printf("\e[1;1h\e[2j"); 

when test is:

#include <stdio.h>  int main(int argc, char *argv[]) {     printf("\e[1;1h\e[2j");     printf("3\n");     sleep(1);      printf("\e[1;1h\e[2j");     printf("2\n");     sleep(1);      printf("\e[1;1h\e[2j");     printf("1\n");     sleep(1);      printf("\e[1;1h\e[2j");     printf("0\n");      return 0; } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -