What i want to do is make a spinner in linux to make it look like the computer is "thinking" while some other process is working. So i was just playing around and can't figure out how to get one to work. Attached is my code. Maybe someone can take a look at it and let me know how i can get it to work.
#include <iostream>
#include <stdlib.h>
#include <unistd.h>
using namespace std;
int main()
{
pid_t mypid;
mypid=fork();
if(mypid==0)
{
for(int i=0;i<4;i++)
{
if(i==0)
{
cout<<"|";
}
if(i==1)
{
cout<<"\b";
cout<<"-";
}
if(i==2)
{
cout<<"\b";
cout<<"|";
}
if(i==3)
{
cout<<"\b";
cout<<"-";
}
sleep(1);
}
return 1;
}
return 0;
}
