CURLOPT_SEEKDATA.3 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. .\" generated by cd2nroff 0.1 from CURLOPT_SEEKDATA.md
  2. .TH CURLOPT_SEEKDATA 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_SEEKDATA \- pointer passed to the seek callback
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SEEKDATA, void *pointer);
  9. .fi
  10. .SH DESCRIPTION
  11. Data \fIpointer\fP to pass to the seek callback function. If you use the
  12. \fICURLOPT_SEEKFUNCTION(3)\fP option, this is the pointer you get as input.
  13. .SH DEFAULT
  14. If you do not set this, NULL is passed to the callback.
  15. .SH PROTOCOLS
  16. This functionality affects all supported protocols
  17. .SH EXAMPLE
  18. .nf
  19. #include <unistd.h> /* for lseek() */
  20. struct data {
  21. int our_fd;
  22. };
  23. static int seek_cb(void *clientp, curl_off_t offset, int origin)
  24. {
  25. struct data *d = (struct data *)clientp;
  26. lseek(d->our_fd, offset, origin);
  27. return CURL_SEEKFUNC_OK;
  28. }
  29. int main(void)
  30. {
  31. struct data seek_data;
  32. CURL *curl = curl_easy_init();
  33. if(curl) {
  34. curl_easy_setopt(curl, CURLOPT_SEEKFUNCTION, seek_cb);
  35. curl_easy_setopt(curl, CURLOPT_SEEKDATA, &seek_data);
  36. }
  37. }
  38. .fi
  39. .SH AVAILABILITY
  40. Added in curl 7.18.0
  41. .SH RETURN VALUE
  42. .SH SEE ALSO
  43. .BR CURLOPT_DEBUGFUNCTION (3),
  44. .BR CURLOPT_IOCTLFUNCTION (3),
  45. .BR CURLOPT_SEEKFUNCTION (3),
  46. .BR CURLOPT_STDERR (3)