I\'ve noticed that a lot of command line tools, wget for example, will show progress as a number or progress bar that advances as a process is completed. While the question isn\
They probably use the fancy ncurses library but on my Linux
for my personal command-line tools I simply send '\r'
to move the cursor back to the start of the line to overwrite it with new progress information.
#include
#include
#include
int main()
{
for(auto i = 0; i < 100; ++i)
{
std::cout << "\rprogress: " << i << "% " << std::flush;
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
std::cout << "\rprogress: DONE " << std::flush;
}