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