1CURLOPT_WRITEDATA(3) curl_easy_setopt options CURLOPT_WRITEDATA(3)
2
3
4
6 CURLOPT_WRITEDATA - custom pointer passed to the write callback
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_WRITEDATA, void
12 *pointer);
13
15 A data pointer to pass to the write callback. If you use the CUR‐
16 LOPT_WRITEFUNCTION(3) option, this is the pointer you'll get in that
17 callback's 4th argument. If you don't use a write callback, you must
18 make pointer a 'FILE *' (cast to 'void *') as libcurl will pass this to
19 fwrite(3) when writing data.
20
21 The internal CURLOPT_WRITEFUNCTION(3) will write the data to the FILE *
22 given with this option, or to stdout if this option hasn't been set.
23
24 If you're using libcurl as a win32 DLL, you MUST use a CURLOPT_WRITE‐
25 FUNCTION(3) if you set this option or you will experience crashes.
26
28 By default, this is a FILE * to stdout.
29
31 Used for all protocols.
32
34 A common technique is to use the write callback to store the incoming
35 data into a dynamically growing allocated buffer, and then this CUR‐
36 LOPT_WRITEDATA(3) is used to point to a struct or the buffer to store
37 data in. Like in the getinmemory example:
38 https://curl.haxx.se/libcurl/c/getinmemory.html
39
41 Available in all libcurl versions. This option was formerly known as
42 CURLOPT_FILE, the name CURLOPT_WRITEDATA(3) was introduced in 7.9.7.
43
45 This will return CURLE_OK.
46
48 CURLOPT_WRITEFUNCTION(3), CURLOPT_READDATA(3),
49
50
51
52libcurl 7.61.1 August 11, 2018 CURLOPT_WRITEDATA(3)