CURLINFO_PRIVATE.3 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. .\" generated by cd2nroff 0.1 from CURLINFO_PRIVATE.md
  2. .TH CURLINFO_PRIVATE 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLINFO_PRIVATE \- get the private pointer
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRIVATE, char **private);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a pointer to a char pointer to receive the pointer to the private data
  12. associated with the curl handle (set with the \fICURLOPT_PRIVATE(3)\fP).
  13. Please note that for internal reasons, the value is returned as a char
  14. pointer, although effectively being a \(aqvoid *\(aq.
  15. .SH PROTOCOLS
  16. This functionality affects all supported protocols
  17. .SH EXAMPLE
  18. .nf
  19. int main(void)
  20. {
  21. CURL *curl = curl_easy_init();
  22. if(curl) {
  23. CURLcode res;
  24. void *pointer = (void *)0x2345454;
  25. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
  26. /* set the private pointer */
  27. curl_easy_setopt(curl, CURLOPT_PRIVATE, pointer);
  28. res = curl_easy_perform(curl);
  29. /* extract the private pointer again */
  30. res = curl_easy_getinfo(curl, CURLINFO_PRIVATE, &pointer);
  31. if(res)
  32. printf("error: %s\\n", curl_easy_strerror(res));
  33. curl_easy_cleanup(curl);
  34. }
  35. }
  36. .fi
  37. .SH AVAILABILITY
  38. Added in curl 7.10.3
  39. .SH RETURN VALUE
  40. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  41. .SH SEE ALSO
  42. .BR CURLOPT_PRIVATE (3),
  43. .BR curl_easy_getinfo (3),
  44. .BR curl_easy_setopt (3)