curl-library
progress callback not working?
Date: Sat, 26 Jan 2002 23:31:03 +0000
I can't get the progress callback to work... The file downloads OK, but
myprogress never gets called. What am I doing wrong?
-- Finlay
int myprogress (void *clientp,
size_t dltotal,
size_t dlnow,
size_t ultotal,
size_t ulnow)
{
printf("%d / %d (%g %%)\n", dltotal, dlnow, dlnow*100.0/dltotal);
return 0;
}
someFunc {
CURL *curl;
CURLcode res;
FILE *outfile;
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if(curl)
{
outfile = fopen("/tmp/test.curl", "w");
curl_easy_setopt(curl, CURLOPT_URL,
"http://curl.haxx.se/download/curl-7.9.2.tar.bz2");
curl_easy_setopt(curl, CURLOPT_FILE, outfile);
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, myprogress);
curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, progressIndicator);
res = curl_easy_perform(curl);
fclose(outfile);
/* always cleanup */
curl_easy_cleanup(curl);
}
curl_global_cleanup();
}
Received on 2002-01-27