1*6236dae4SAndroid Build Coastguard Worker--- 2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al. 3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl 4*6236dae4SAndroid Build Coastguard WorkerTitle: CURLOPT_WRITEDATA 5*6236dae4SAndroid Build Coastguard WorkerSection: 3 6*6236dae4SAndroid Build Coastguard WorkerSource: libcurl 7*6236dae4SAndroid Build Coastguard WorkerSee-also: 8*6236dae4SAndroid Build Coastguard Worker - CURLOPT_HEADERDATA (3) 9*6236dae4SAndroid Build Coastguard Worker - CURLOPT_READDATA (3) 10*6236dae4SAndroid Build Coastguard Worker - CURLOPT_WRITEFUNCTION (3) 11*6236dae4SAndroid Build Coastguard WorkerProtocol: 12*6236dae4SAndroid Build Coastguard Worker - All 13*6236dae4SAndroid Build Coastguard WorkerAdded-in: 7.9.7 14*6236dae4SAndroid Build Coastguard Worker--- 15*6236dae4SAndroid Build Coastguard Worker 16*6236dae4SAndroid Build Coastguard Worker# NAME 17*6236dae4SAndroid Build Coastguard Worker 18*6236dae4SAndroid Build Coastguard WorkerCURLOPT_WRITEDATA - pointer passed to the write callback 19*6236dae4SAndroid Build Coastguard Worker 20*6236dae4SAndroid Build Coastguard Worker# SYNOPSIS 21*6236dae4SAndroid Build Coastguard Worker 22*6236dae4SAndroid Build Coastguard Worker~~~c 23*6236dae4SAndroid Build Coastguard Worker#include <curl/curl.h> 24*6236dae4SAndroid Build Coastguard Worker 25*6236dae4SAndroid Build Coastguard WorkerCURLcode curl_easy_setopt(CURL *handle, CURLOPT_WRITEDATA, void *pointer); 26*6236dae4SAndroid Build Coastguard Worker~~~ 27*6236dae4SAndroid Build Coastguard Worker 28*6236dae4SAndroid Build Coastguard Worker# DESCRIPTION 29*6236dae4SAndroid Build Coastguard Worker 30*6236dae4SAndroid Build Coastguard WorkerA data *pointer* to pass to the write callback. If you use the 31*6236dae4SAndroid Build Coastguard WorkerCURLOPT_WRITEFUNCTION(3) option, this is the pointer you get in that 32*6236dae4SAndroid Build Coastguard Workercallback's fourth and last argument. If you do not use a write callback, you 33*6236dae4SAndroid Build Coastguard Workermust make *pointer* a 'FILE *' (cast to 'void *') as libcurl passes this 34*6236dae4SAndroid Build Coastguard Workerto *fwrite(3)* when writing data. 35*6236dae4SAndroid Build Coastguard Worker 36*6236dae4SAndroid Build Coastguard WorkerThe internal CURLOPT_WRITEFUNCTION(3) writes the data to the FILE * 37*6236dae4SAndroid Build Coastguard Workergiven with this option, or to stdout if this option has not been set. 38*6236dae4SAndroid Build Coastguard Worker 39*6236dae4SAndroid Build Coastguard WorkerIf you are using libcurl as a Windows DLL, you **MUST** use a 40*6236dae4SAndroid Build Coastguard WorkerCURLOPT_WRITEFUNCTION(3) if you set this option or you might experience 41*6236dae4SAndroid Build Coastguard Workercrashes. 42*6236dae4SAndroid Build Coastguard Worker 43*6236dae4SAndroid Build Coastguard Worker# DEFAULT 44*6236dae4SAndroid Build Coastguard Worker 45*6236dae4SAndroid Build Coastguard Workerstdout 46*6236dae4SAndroid Build Coastguard Worker 47*6236dae4SAndroid Build Coastguard Worker# %PROTOCOLS% 48*6236dae4SAndroid Build Coastguard Worker 49*6236dae4SAndroid Build Coastguard Worker# EXAMPLE 50*6236dae4SAndroid Build Coastguard Worker 51*6236dae4SAndroid Build Coastguard WorkerA common technique is to use the write callback to store the incoming data 52*6236dae4SAndroid Build Coastguard Workerinto a dynamically growing allocated buffer, and then this 53*6236dae4SAndroid Build Coastguard WorkerCURLOPT_WRITEDATA(3) is used to point to a struct or the buffer to store data 54*6236dae4SAndroid Build Coastguard Workerin. Like in the getinmemory example: 55*6236dae4SAndroid Build Coastguard Workerhttps://curl.se/libcurl/c/getinmemory.html 56*6236dae4SAndroid Build Coastguard Worker 57*6236dae4SAndroid Build Coastguard Worker# HISTORY 58*6236dae4SAndroid Build Coastguard Worker 59*6236dae4SAndroid Build Coastguard WorkerThis option was formerly known as CURLOPT_FILE, the name CURLOPT_WRITEDATA(3) 60*6236dae4SAndroid Build Coastguard Workerwas added in 7.9.7. 61*6236dae4SAndroid Build Coastguard Worker 62*6236dae4SAndroid Build Coastguard Worker# %AVAILABILITY% 63*6236dae4SAndroid Build Coastguard Worker 64*6236dae4SAndroid Build Coastguard Worker# RETURN VALUE 65*6236dae4SAndroid Build Coastguard Worker 66*6236dae4SAndroid Build Coastguard WorkerThis returns CURLE_OK. 67