Skip to content

Instantly share code, notes, and snippets.

@ato
Forked from farcaller/scroller.c
Created October 25, 2009 12:53
Show Gist options
  • Save ato/218049 to your computer and use it in GitHub Desktop.
Save ato/218049 to your computer and use it in GitHub Desktop.
// simplified and fixed bug where too many \b characters were printed
#include <stdio.h>
#include <unistd.h>
int main (int argc, const char *argv[])
{
int i;
const char scroller[] = "|/-\\";
for(i=0; i<20; ++i) {
printf("%c", scroller[i % (sizeof(scroller) - 1)]);
fflush(stdout);
sleep(1);
printf("\b");
}
printf("\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment