jpbarrette/curlpp

[question]how to use progressfunction to get upload or download progress value

xuyiqun-learner opened this issue · 2 comments

is the same usage of ReadFucnction as ProgressFunction that to get progress value in the example02 ?

If the question is to know how to use ProgressFunction, I currently use this code (file download) :

request.setOpt<curlpp::options::ProgressFunction>(
   [&location, &reporter](const double totalDownloaded, const double currentlyDownloaded, double, double)-> int
   {
      if (totalDownloaded != 0.0)
         reporter(location.string(), static_cast<float>(currentlyDownloaded * 100.0l / totalDownloaded));
      return CURL_PROGRESSFUNC_CONTINUE;
   });

Full code available here