C语言模仿wget的进度条效果的代码

将写代码过程中比较好的代码段备份一次,如下资料是关于C语言模仿wget的进度条效果的代码,希望能对大伙有一些好处。

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

{
unsigned len = 60;
for (int i = 0; i < len + 1; ++i)
{
bar[i] = '#';
}
for (int i = 0; i < len; ++i)
{
printf("progress:[%s]%d%%r", bar+len-i, i+1);
usleep(100000);
}
printf("n");
return 0;
}




 

posted @ 2021-11-26 21:17  androidyou  阅读(48)  评论(0编辑  收藏  举报