Created
December 16, 2019 18:11
-
-
Save LeSpocky/890e87b9176cf338a31b2f0bfef681c8 to your computer and use it in GitHub Desktop.
quick and dirty throbber inspired by https://twitter.com/dasnuf/status/1206544394251374592 and https://de.wikipedia.org/wiki/Throbber
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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