1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_SEEKDATA 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_DEBUGFUNCTION (3) 9 - CURLOPT_IOCTLFUNCTION (3) 10 - CURLOPT_SEEKFUNCTION (3) 11 - CURLOPT_STDERR (3) 12Protocol: 13 - All 14Added-in: 7.18.0 15--- 16 17# NAME 18 19CURLOPT_SEEKDATA - pointer passed to the seek callback 20 21# SYNOPSIS 22 23~~~c 24#include <curl/curl.h> 25 26CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SEEKDATA, void *pointer); 27~~~ 28 29# DESCRIPTION 30 31Data *pointer* to pass to the seek callback function. If you use the 32CURLOPT_SEEKFUNCTION(3) option, this is the pointer you get as input. 33 34# DEFAULT 35 36If you do not set this, NULL is passed to the callback. 37 38# %PROTOCOLS% 39 40# EXAMPLE 41 42~~~c 43#include <unistd.h> /* for lseek() */ 44 45struct data { 46 int our_fd; 47}; 48 49static int seek_cb(void *clientp, curl_off_t offset, int origin) 50{ 51 struct data *d = (struct data *)clientp; 52 lseek(d->our_fd, offset, origin); 53 return CURL_SEEKFUNC_OK; 54} 55 56int main(void) 57{ 58 struct data seek_data; 59 CURL *curl = curl_easy_init(); 60 if(curl) { 61 curl_easy_setopt(curl, CURLOPT_SEEKFUNCTION, seek_cb); 62 curl_easy_setopt(curl, CURLOPT_SEEKDATA, &seek_data); 63 } 64} 65~~~ 66 67# %AVAILABILITY% 68 69# RETURN VALUE 70