Last active
August 29, 2015 14:11
-
-
Save carneeki/14dc07e1c68a99326f4b to your computer and use it in GitHub Desktop.
Text throbber / waiting thingy
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 <iostream> | |
#define SLEEP 100000 // 100 millis | |
using namespace std; | |
void throb(char in) | |
{ | |
cout << "\b" << in; | |
cout.flush(); | |
usleep(SLEEP); | |
} | |
int main() | |
{ | |
while(true) | |
{ | |
throb('|'); | |
throb('/'); | |
throb('-'); | |
throb('\\'); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You're gonna need to include unistd.h.