Skip to content

Instantly share code, notes, and snippets.

@stillinbeta
Last active December 29, 2015 01:09
Show Gist options
  • Save stillinbeta/7591246 to your computer and use it in GitHub Desktop.
Save stillinbeta/7591246 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <unistd.h>
void
twiddle(void)
{
static int state;
static char states[] = { '|', '/', '-', '\\' };
state++;
state = state % 4;
printf("%c\b", states[state]);
fflush(stdout);
}
int
main(void)
{
while(1) {
sleep(1);
twiddle();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment