将更改的输出发送到控制台窗口. [英] Sending changing output to the console window.

查看:93
本文介绍了将更改的输出发送到控制台窗口.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我试图以百分比显示过程的进度,但是有点像当您使用命令提示符格式化驱动器并显示已完成百分比时.问题是如何在同一行上显示变化的百分比. Console.Writeline(value)刚刚将%age写入了新行.有人知道怎么做吗?


Hi, am trying to display the progress of a process in percentage but sort of like when you use the command prompt to format a drive and it shows the percentage done. Problem is how to display the changing percentages on the same line. Console.Writeline(value) just wrote the %age on a new line. Anyone knows how to do this?

推荐答案

使用Console.Write(),并在每个字符串的开头放置一个退格字符,用于您写的非退格字符
Use Console.Write(), and at the beginning of each string put a backspace character for as many non-backspace characters as you wrote the previous time.


除了约翰的答案:

退格键为"0x8".

—SA
In addition to John''s Answer:

Backspace is ''0x8''.

—SA


这篇关于将更改的输出发送到控制台窗口.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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