CppProgressBar is a C++ header-library to output progress bar to the terminal.
- simple progerss bar
- easy to use
- can visualize your output
If you use this library, you can output like the gif below.
You need C++11 or later.
$ git clone https://github.com/ysuzuki19/CppProgressBar
This repository is header-only, so you can use without installing. To use this header, there are 3 ways.
Add the following line to the top of the program.
#include "/path/to/CppProgressBar.hpp"
Run following command to compile.
$ g++ main.cpp -I/path/to/CppProgressBar/include/ -o project
Run following command.
$ ln -s /path/to/CppProgressBar.hpp /usr/local/include/
Definition lambda expression and call for_progress(loop_number, lambda_func)
like following part.
loop_number
: number of loopslambda_func
: your process
int cnt = 0;
auto process = [&cnt](std::string& output_string) {
/*your process*/
cnt ++;
/*if you don't need output, following line is unnecessary.*/
output_string = /*your custom output*/;
};
for_progress(100, process);
Sample code is /test/test.cpp