#include <stdlib.h> #include <stdio.h> #include <sys/ioctl.h> #include <unistd.h> #include <string.h> int main() { int i; struct winsize w; char *spaces; ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); * whole window (rows * cols):*/ spaces = (char *)malloc(w.ws_row * w.ws_col); memset(spaces, ' ', w.ws_row * w.ws_col); * rows * cols of white spaces: */ for(i = 0; 1; i++) { printf("\e[7;%dm\n", 31 + i%6); write(1, spaces, w.ws_row * w.ws_col); usleep(1000 * 1000); } return 0; }
|