Skip to content

Instantly share code, notes, and snippets.

@eagletmt
Created March 25, 2016 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eagletmt/704980a5a2aad401712e to your computer and use it in GitHub Desktop.
Save eagletmt/704980a5a2aad401712e to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
int main(void) {
srand(time(NULL));
const int N = 50;
for (;;) {
int n = rand() % N;
int i;
fputs("\rprogress bar [", stdout);
for (i = 0; i < n; i++) {
putchar('#');
}
for (i = n; i < N; i++) {
putchar(' ');
}
putchar(']');
usleep(10000);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment