File: printprogress.cc

package info (click to toggle)
qdmr 0.13.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,420 kB
  • sloc: cpp: 95,929; xml: 10,749; python: 1,108; makefile: 78; sh: 9
file content (21 lines) | stat: -rw-r--r-- 351 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "printprogress.hh"

#include <QTextStream>


void print_progress(int prog) {
  QTextStream out(stdout);
  out << "\r";
  out.setFieldWidth(2);
  out << prog;
  out.setFieldWidth(0);
  out << "%";
  prog = (prog*20)/100;
  out << "[";
  for (int i=0; i<prog; i++)
    out << "*";
  for (int i=prog; i<20; i++)
    out << " ";
  out << "]";
}