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