Created
September 18, 2017 00:29
-
-
Save diegozr1/118bfc247bce5aa4d85c29e76dda20fa to your computer and use it in GitHub Desktop.
Loading simulation in c
This file contains 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() | |
{ | |
char bar[] = { | |
'-', | |
'\\', | |
'|', | |
'/' | |
}; | |
unsigned int i; | |
int speed = 40000; //miliseconds | |
for (i = 0; ; ++i) { | |
printf("Loading ... %c \r", bar[i % sizeof(bar)]); | |
fflush(stdout); // clean | |
usleep(speed); // resets execution | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment