How do I erase printed characters in a console application(Linux)?

前端 未结 6 1610
慢半拍i
慢半拍i 2020-12-14 19:54

I am creating a small console app that needs a progress bar. Something like...

Conversion: 175/348 Seconds   |==========          |  50%

My

6条回答
  •  情深已故
    2020-12-14 20:28

    This seems to be pretty old topic but I will drop my 5 into.

    for ($i; $i<_POSITION_; $i--) {
       echo "\010"; //issue backspace 
    }
    

    Found this on the internet some time ago, unfortunately don't remember where. So all credits goes to original author.

提交回复
热议问题