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