#include "stdio.h"
#include "unistd.h"
#include "string.h"
#define NUM 101
int main() {
char bar[NUM];
memset(bar, 0, sizeof(bar));
int i = 0;
const char label[] = "|/-\\";
while (i < NUM) {
bar[i] = '#';
printf("[%-100s][%d%%][%c]\r", bar, i, label[i % 4]);
fflush(stdout);
usleep(100000);
i++;
}
return 0;
}
【Linux学习笔记】模拟进度条
最新推荐文章于 2024-11-02 15:22:06 发布