Monday, May 21, 2012

Showing progress in command-line application

Ok, i am a bit embarrassed to ask such a simple thing but still.



I have command line utility application and need to implement showing progress to the user.



I could write progress into cout, like this:



std::cout << "10%\n";
...
std::cout << "20%\n";
...
std::cout << "30%\n";


... but as a result user will see:



some line printed before
10%
20%
30%
...


... but what i really need is that percentage got updated
, like this at the beginning:



some line printed before
10%
...


... and after update:



some line printed before
20%
...


... and after second update:



some line printed before
30%
...


How should i manage this?





No comments:

Post a Comment