Hi Guys,
I need your help again. There is a project I'm working on for my job attatchment. It requires that I use a progress bar to show the progress of the file I am currently uploading to the database. The program's code also contains a line counter which counts the lines in the file imported to see how many lines will be added to the database. I am wondering : is it possible that I could somehow use the values created by this "LineCount" function to set mininmum and maximum values for the progress bar? If so, how would I get those values from this constantly incremented integer?

Thanks,
KemarS

you could use boost::progress_display http://www.boost.org/libs/timer/timer.htm

#include <boost/progress.hpp>
#include <iostream>
#include <unistd.h>

int main()
{
  enum { LINES_IN_FILE = 1000 } ;
  boost::progress_display display( LINES_IN_FILE, std::cout ) ;
  for( int i=0 ; i<LINES_IN_FILE ; ++i )
  {
    // process one line, add to database
    usleep( 10 ) ; // simulate taking 10 microsecs for this
    ++display ;
  }
}

Is there a way to declare the progress_display before initializing it, so you can do something like this:

void MyFunc(const bool progressbar)
{
boost::progress_display display;
if(progressbar)
  display = boost::progress_display(LINES_IN_FILE);
  for( int i=0 ; i<LINES_IN_FILE ; ++i )
  {
    //do something
    if(progressbar)
       ++display ;
  }
}