实现环境:Centos6.5
实现代码:
#include<stdio.h>
#include<unistd.h>
#include<string.h>
int main()
{
char buf[50]={0};
const char *label="|/-\\";
int i=0;
for(;i<50;++i)
{
buf[i]='#';
printf("[%d%%][%c][%s]\r",i*2,label[i%4],buf);
fflush(stdout);
usleep(100000);
}
return 1;
}
Makefile文件:
test:test.c
gcc test.c -o test
.PHONY:clean
clean:
rm -f test.i test.s test.o test
本文展示了一个简单的C语言程序,用于在CentOS 6.5环境下实现一个文本界面的加载进度条效果。通过不断更新输出来模拟进度,并使用简单的动画符号增强视觉效果。
3980

被折叠的 条评论
为什么被折叠?



