I am working on a simple clone clone for a terminal and need a way to delay the print of a βframeβ.
I have a two dimensional array
screen[ROWS][COLUMNS]
and the function that prints the screen
void printScreen() { int i = 0; int j; while(i < ROWS) { j = 0; while(j < COLUMNS) { printf("%c", screen[i][j]); j++; } i++; } }
It seems like when I do
printScreen(); usleep(1000000); printScreen();
it will be sleep execution during printScreen() .
Any advice for this type of animation on the terminal would be greatly appreciated. Perhaps I am doing this completely wrong. How is this done with ASCII movies like this ?
EDIT I'm going with ncurses. Thank you for the suggestion.
On Ubuntu, sudo aptitude install libncurses5-dev and compile with -lncurses .
source share