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 - FTP 14 - HTTP 15 - SFTP 16Added-in: 7.18.0 17--- 18 19# NAME 20 21CURLOPT_SEEKDATA - pointer passed to the seek callback 22 23# SYNOPSIS 24 25~~~c 26#include <curl/curl.h> 27 28CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SEEKDATA, void *pointer); 29~~~ 30 31# DESCRIPTION 32 33Data *pointer* to pass to the seek callback function. If you use the 34CURLOPT_SEEKFUNCTION(3) option, this is the pointer you get as input. 35 36# DEFAULT 37 38If you do not set this, NULL is passed to the callback. 39 40# %PROTOCOLS% 41 42# EXAMPLE 43 44~~~c 45#include <unistd.h> /* for lseek() */ 46 47struct data { 48 int our_fd; 49}; 50 51static int seek_cb(void *clientp, curl_off_t offset, int origin) 52{ 53 struct data *d = (struct data *)clientp; 54 lseek(d->our_fd, offset, origin); 55 return CURL_SEEKFUNC_OK; 56} 57 58int main(void) 59{ 60 struct data seek_data; 61 CURL *curl = curl_easy_init(); 62 if(curl) { 63 curl_easy_setopt(curl, CURLOPT_SEEKFUNCTION, seek_cb); 64 curl_easy_setopt(curl, CURLOPT_SEEKDATA, &seek_data); 65 } 66} 67~~~ 68 69# %AVAILABILITY% 70 71# RETURN VALUE 72