How to update a printed message in terminal without reprinting

后端 未结 8 2156
时光取名叫无心
时光取名叫无心 2020-11-29 02:50

I want to make a progress bar for my terminal application that would work something like:

 [XXXXXXX       ] 

which would give a visual indi

8条回答
  •  醉酒成梦
    2020-11-29 03:35

    '\r' will perform a carriage return. Imagine a printer doing a carriage return without a linefeed ('\n'). This will return the writing point back to the start of the line... then reprint your updated status on top of the original line.

提交回复
热议问题