Skip to content

Instantly share code, notes, and snippets.

@LeSpocky
Created December 16, 2019 18:11
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 LeSpocky/890e87b9176cf338a31b2f0bfef681c8 to your computer and use it in GitHub Desktop.
Save LeSpocky/890e87b9176cf338a31b2f0bfef681c8 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <unistd.h>
int main( int argc, char *argv[] )
{
char c = '-';
printf( "throbber: [-]" );
while ( 1 )
{
switch ( c )
{
case '\\': c = '|'; break;
case '|': c = '/'; break;
case '/': c = '-'; break;
case '-': c = '\\'; break;
default: c = '-'; break;
}
usleep( 1000 * 150 );
printf( "\b\b%c]", c );
fflush( stdout );
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment