1CURLOPT_PROGRESSDATA(3) curl_easy_setopt options CURLOPT_PROGRESSDATA(3)
2
3
4
6 CURLOPT_PROGRESSDATA - pointer passed to the progress callback
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROGRESSDATA, void *pointer);
12
14 Pass a pointer that will be untouched by libcurl and passed as the
15 first argument in the progress callback set with CURLOPT_PROGRESSFUNC‐
16 TION(3).
17
19 The default value of this parameter is NULL.
20
22 All
23
25 struct progress {
26 char *private;
27 size_t size;
28 };
29
30 static size_t progress_callback(void *clientp,
31 double dltotal,
32 double dlnow,
33 double ultotal,
34 double ulnow)
35 {
36 struct memory *progress = (struct progress *)userp;
37
38 /* use the values */
39
40 return 0; /* all is good */
41 }
42
43 struct progress data;
44
45 /* pass struct to callback */
46 curl_easy_setopt(curl_handle, CURLOPT_PROGRESSDATA, &data);
47
48 curl_easy_setopt(curl_handle, CURLOPT_PROGRESSFUNCTION, progress_callback);
49
51 Always
52
54 Returns CURLE_OK
55
57 CURLOPT_PROGRESSFUNCTION(3), CURLOPT_XFERINFOFUNCTION(3),
58
59
60
61libcurl 7.85.0 May 17, 2022 CURLOPT_PROGRESSDATA(3)