This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <unistd.h> | |
| #include <string.h> | |
| void statusbar_to_stdout (const char * item, int percentage) { | |
| int i, pos; | |
| char per_bar [50 + 1] = {'-'}; | |
| if (percentage > 100) percentage %= 100; | |
| pos = percentage / 2; | |
| printf ("\e[?25l"); // Hide cursor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <unistd.h> | |
| int main() { | |
| setvbuf(stdout, NULL, _IONBF, 0); | |
| for(int i=0; i<100; i++) { | |
| usleep(70000); | |
| printf("\r"); | |
| switch(i%4) { | |
| case 0: printf("/"); break; |