Sortix nightly manual
This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.
CURLOPT_XFERINFOFUNCTION(3) | Library Functions Manual | CURLOPT_XFERINFOFUNCTION(3) |
NAME
CURLOPT_XFERINFOFUNCTION - progress meter callbackSYNOPSIS
#include <curl/curl.h>
int progress_callback(void *clientp,
curl_off_t dltotal,
curl_off_t dlnow,
curl_off_t ultotal,
curl_off_t ulnow);
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_XFERINFOFUNCTION,
progress_callback);
DESCRIPTION
Pass a pointer to your callback function, which should match the prototype shown above.DEFAULT
NULL - use the internal progress meter. That is rarely wanted by users.PROTOCOLS
This functionality affects all supported protocolsEXAMPLE
struct progress {
char *private;
size_t size;
};
static size_t progress_callback(void *clientp,
curl_off_t dltotal,
curl_off_t dlnow,
curl_off_t ultotal,
curl_off_t ulnow)
{
struct progress *memory = clientp;
printf("my ptr: %p\n", memory->private);
/* use the values */
return 0; /* all is good */
}
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
struct progress data;
/* pass struct to callback */
curl_easy_setopt(curl, CURLOPT_XFERINFODATA, &data);
/* enable progress callback getting called */
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, progress_callback);
}
}
AVAILABILITY
Added in curl 7.32.0RETURN VALUE
Returns CURLE_OK.SEE ALSO
CURLOPT_NOPROGRESS(3), CURLOPT_XFERINFODATA(3)2024-12-21 | libcurl |