[Ilugc] Progressbar on shell
- From: arun289@xxxxxxxxx (Arun Venkataswamy)
- Date: Thu Dec 25 17:02:04 2008
On Thu, Dec 25, 2008 at 2:50 PM, abdullah abdul Khadir <
abdullah.ak2002@xxxxxxxxx> wrote:
Hi,
Does anyone here know how to implement a progress bar in C that
displays a series of '=' on the command line when run. I intend the
progressbar to look like :
|=========>
| [25%]
Simple C code - without any data validation
void pbar(int width,int percent)
{
int a;
printf("\r[");
for(a=0;a<(percent*width/100);a++) printf("=");
printf(">");
for(;a<width;a++) printf(" ");
printf("]%d%%",percent);
}
Displays the number also on the same line but....
--
Arun Venkataswamy
Other related posts: