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

NAME

6       CURLOPT_WRITEDATA - pointer passed to the write callback
7

SYNOPSIS

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

DESCRIPTION

14       A  data  pointer  to  pass  to  the write callback. If you use the CUR‐
15       LOPT_WRITEFUNCTION(3) option, this is the pointer you will get in  that
16       callback's  fourth  and  last argument. If you do not use a write call‐
17       back, you must make pointer a 'FILE *' (cast to 'void  *')  as  libcurl
18       will pass this to fwrite(3) when writing data.
19
20       The internal CURLOPT_WRITEFUNCTION(3) will write the data to the FILE *
21       given with this option, or to stdout if this option has not been set.
22
23       If you are using libcurl as a win32 DLL, you MUST use a  CURLOPT_WRITE‐
24       FUNCTION(3) if you set this option or you will experience crashes.
25

DEFAULT

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

PROTOCOLS

30       Used for all protocols.
31

EXAMPLE

33       A  common  technique is to use the write callback to store the incoming
34       data into a dynamically growing allocated buffer, and  then  this  CUR‐
35       LOPT_WRITEDATA(3)  is  used to point to a struct or the buffer to store
36       data      in.      Like      in      the      getinmemory      example:
37       https://curl.se/libcurl/c/getinmemory.html
38

AVAILABILITY

40       Available  in  all  libcurl versions. This option was formerly known as
41       CURLOPT_FILE, the name CURLOPT_WRITEDATA(3) was introduced in 7.9.7.
42

RETURN VALUE

44       This will return CURLE_OK.
45

SEE ALSO

47       CURLOPT_WRITEFUNCTION(3), CURLOPT_READDATA(3),
48
49
50
51libcurl 8.0.1                  January 02, 2023           CURLOPT_WRITEDATA(3)
Impressum