Skip to content

Instantly share code, notes, and snippets.

@carneeki
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save carneeki/14dc07e1c68a99326f4b to your computer and use it in GitHub Desktop.
Save carneeki/14dc07e1c68a99326f4b to your computer and use it in GitHub Desktop.
Text throbber / waiting thingy
#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;
}
@cuttlebit
Copy link

You're gonna need to include unistd.h.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment