如何显示在纯C / C ++(COUT / printf的)进度指示器? [英] How to display a progress indicator in pure C/C++ (cout/printf)?

查看:333
本文介绍了如何显示在纯C / C ++(COUT / printf的)进度指示器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写C ++中的控制台程序来下载一个大文件。我知道文件的大小,我开始工作线程下载。我想显示一个进度指示器,使它看起来更酷。

I'm writing a console program in C++ to download a large file. I have known the file size, and I start a work thread to download. I want to show a progress indicator to make it look cooler.

如何显示在不同时间不同的弦,但在相同的位置,在COUT或printf

How to display different strings at different times, but at the same position, in cout or printf?

推荐答案

您可以使用一个回车(\\ r)的不换行(\\ n),并且希望您的控制台做正确的事。

You can use a "carriage return" (\r) without a line-feed (\n), and hope your console does the right thing.

这篇关于如何显示在纯C / C ++(COUT / printf的)进度指示器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆