Skip to content

Instantly share code, notes, and snippets.

@LeSpocky
Created Dec 16, 2019
Embed
What would you like to do?
#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