美文网首页
C语言模仿wget的进度条效果的代码

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

作者: giveyoume | 来源:发表于2021-11-16 23:53 被阅读0次

将写代码过程中比较好的代码段备份一次,如下资料是关于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;

}

相关文章

网友评论

      本文标题:C语言模仿wget的进度条效果的代码

      本文链接:https://www.haomeiwen.com/subject/upgktrtx.html