How to update a printed message in terminal without reprinting

后端 未结 8 2165
时光取名叫无心
时光取名叫无心 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:17

    try using \r instead of \n when printing the new "version".

    for(int i=0;i<=100;++i) printf("\r[%3d%%]",i);
    printf("\n");
    

提交回复
热议问题