ProgressBar
Loading...
Searching...
No Matches
handle_output.cpp

Example on usage of ProgressBar showing how to handle output in terminal while ProgressBar is in progress

#include <unistd.h>
#include "PBar.hpp"
void DoSomething() {usleep(1e3);}
int main()
{
ProgressBar pBar("BLOCK1");
std::cout << "An example that shows how to handle output with progress bar" << std::endl;
for (int i = 0; i < 1e3; i++)
{
pBar.Print(static_cast<double>(i)/(1e3 - 1.));
DoSomething();
if ((i + 1) % 100 == 0) pBar.HandleOutput("Number of iterations:", i + 1);
}
pBar.Finish();
}
Contains declaration of class ProgressBar.
Class ProgressBar can be used used to print the progress in an ascii horizontal bar....
Definition PBar.hpp:34