Perl: print back to beginning of line

后端 未结 4 1966
眼角桃花
眼角桃花 2020-12-07 01:28

Okay, so what I\'m trying to do is print out a percentage complete to my command line, now, I would like this to simply \'update\' the number shown on the screen. So somehow

4条回答
  •  时光取名叫无心
    2020-12-07 02:15

    In C and C++, the trick is to print char #13. Maybe it can work in Perl.

    for (int pc = 0 ; pc <= 100 ; ++pc)
        printf("Percentage: %02d %%  %c", pc, 13);
    printf("\n");
    

提交回复
热议问题