1CURLOPT_READDATA(3)        curl_easy_setopt options        CURLOPT_READDATA(3)
2
3
4

NAME

6       CURLOPT_READDATA - custom pointer passed to the read callback
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode    curl_easy_setopt(CURL   *handle,   CURLOPT_READDATA,   void
12       *pointer);
13

DESCRIPTION

15       Data pointer to pass to the file read function. If  you  use  the  CUR‐
16       LOPT_READFUNCTION(3) option, this is the pointer you'll get as input in
17       the 4th argument to the callback.
18
19       If you don't specify a read callback but instead rely  on  the  default
20       internal read function, this data must be a valid readable FILE * (cast
21       to 'void *').
22
23       If you're using libcurl as a win32 DLL, you MUST  use  a  CURLOPT_READ‐
24       FUNCTION(3) if you set this option or you will experience crashes.
25

DEFAULT

27       By default, this is a FILE * to stdin.
28

PROTOCOLS

30       This is used for all protocols when sending data.
31

EXAMPLE

33       CURL *curl = curl_easy_init();
34       struct MyData this;
35       if(curl) {
36         curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
37
38         /* pass pointer that gets passed in to the
39            CURLOPT_READFUNCTION callback */
40         curl_easy_setopt(curl, CURLOPT_READDATA, &this);
41
42         curl_easy_perform(curl);
43       }
44

AVAILABILITY

46       This  option  was once known by the older name CURLOPT_INFILE, the name
47       CURLOPT_READDATA(3) was introduced in 7.9.7.
48

RETURN VALUE

50       This will return CURLE_OK.
51

SEE ALSO

53       CURLOPT_READFUNCTION(3), CURLOPT_WRITEDATA(3),
54
55
56
57libcurl 7.61.1                  August 11, 2018            CURLOPT_READDATA(3)
Impressum