Skip to content

Instantly share code, notes, and snippets.

@deobfuscate
Created March 4, 2020 07:36
Show Gist options
  • Save deobfuscate/58d4a3da60d35fe4a3fc0f2b740272cb to your computer and use it in GitHub Desktop.
Save deobfuscate/58d4a3da60d35fe4a3fc0f2b740272cb to your computer and use it in GitHub Desktop.
Simple ASCII spinner in C
#include <stdio.h>
#include <unistd.h>
#define DELAY 100000 // microseconds
void main() {
printf(" ");
while(1) {
printf("\b|");
fflush(stdout);
usleep(DELAY);
printf("\b/");
fflush(stdout);
usleep(DELAY);
printf("\b-");
fflush(stdout);
usleep(DELAY);
printf("\b\\");
fflush(stdout);
usleep(DELAY);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment