1CURLOPT_WRITEDATA(3) curl_easy_setopt options CURLOPT_WRITEDATA(3)
2
3
4
6 CURLOPT_WRITEDATA - pointer passed to the write callback
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_WRITEDATA, void *pointer);
12
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 4th argument. If you do not use a write callback, you must
17 make pointer a 'FILE *' (cast to 'void *') as libcurl will pass this to
18 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
27 By default, this is a FILE * to stdout.
28
30 Used for all protocols.
31
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
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
44 This will return CURLE_OK.
45
47 CURLOPT_WRITEFUNCTION(3), CURLOPT_READDATA(3),
48
49
50
51libcurl 7.85.0 May 17, 2022 CURLOPT_WRITEDATA(3)