1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_WRITEDATA 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_HEADERDATA (3) 9 - CURLOPT_READDATA (3) 10 - CURLOPT_WRITEFUNCTION (3) 11Protocol: 12 - All 13--- 14 15# NAME 16 17CURLOPT_WRITEDATA - pointer passed to the write callback 18 19# SYNOPSIS 20 21~~~c 22#include <curl/curl.h> 23 24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_WRITEDATA, void *pointer); 25~~~ 26 27# DESCRIPTION 28 29A data *pointer* to pass to the write callback. If you use the 30CURLOPT_WRITEFUNCTION(3) option, this is the pointer you get in that 31callback's fourth and last argument. If you do not use a write callback, you 32must make *pointer* a 'FILE *' (cast to 'void *') as libcurl passes this 33to *fwrite(3)* when writing data. 34 35The internal CURLOPT_WRITEFUNCTION(3) writes the data to the FILE * 36given with this option, or to stdout if this option has not been set. 37 38If you are using libcurl as a Windows DLL, you **MUST** use a 39CURLOPT_WRITEFUNCTION(3) if you set this option or you might experience 40crashes. 41 42# DEFAULT 43 44By default, this is a FILE * to stdout. 45 46# EXAMPLE 47 48A common technique is to use the write callback to store the incoming data 49into a dynamically growing allocated buffer, and then this 50CURLOPT_WRITEDATA(3) is used to point to a struct or the buffer to store 51data in. Like in the getinmemory example: 52https://curl.se/libcurl/c/getinmemory.html 53 54# AVAILABILITY 55 56Available in all libcurl versions. This option was formerly known as 57CURLOPT_FILE, the name CURLOPT_WRITEDATA(3) was added in 7.9.7. 58 59# RETURN VALUE 60 61This returns CURLE_OK. 62