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

NAME

6       CURLOPT_READDATA - pointer passed to the read callback
7

SYNOPSIS

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

DESCRIPTION

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

DEFAULT

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

PROTOCOLS

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

EXAMPLE

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

AVAILABILITY

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

RETURN VALUE

49       This will return CURLE_OK.
50

SEE ALSO

52       CURLOPT_READFUNCTION(3), CURLOPT_WRITEDATA(3),
53
54
55
56libcurl 8.0.1                  January 02, 2023            CURLOPT_READDATA(3)
Impressum