Skip to content

Instantly share code, notes, and snippets.

@alculquicondor
Created September 21, 2012 03:56
Show Gist options
  • Save alculquicondor/3759650 to your computer and use it in GitHub Desktop.
Save alculquicondor/3759650 to your computer and use it in GitHub Desktop.
Console progress bar
#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;
case 1: printf("-"); break;
case 2: printf("\\"); break;
case 3: printf("|"); break;
}
}
puts("");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment