| 1 |
.\" ************************************************************************** |
| 2 |
.\" * _ _ ____ _ |
| 3 |
.\" * Project ___| | | | _ \| | |
| 4 |
.\" * / __| | | | |_) | | |
| 5 |
.\" * | (__| |_| | _ <| |___ |
| 6 |
.\" * \___|\___/|_| \_\_____| |
| 7 |
.\" * |
| 8 |
.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <[email protected]>, et al. |
| 9 |
.\" * |
| 10 |
.\" * This software is licensed as described in the file COPYING, which |
| 11 |
.\" * you should have received as part of this distribution. The terms |
| 12 |
.\" * are also available at https://curl.haxx.se/docs/copyright.html. |
| 13 |
.\" * |
| 14 |
.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell |
| 15 |
.\" * copies of the Software, and permit persons to whom the Software is |
| 16 |
.\" * furnished to do so, under the terms of the COPYING file. |
| 17 |
.\" * |
| 18 |
.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 19 |
.\" * KIND, either express or implied. |
| 20 |
.\" * |
| 21 |
.\" ************************************************************************** |
| 22 |
.\" |
| 23 |
.TH CURLOPT_WRITEDATA 3 "16 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options" |
| 24 |
.SH NAME |
| 25 |
CURLOPT_WRITEDATA \- custom pointer passed to the write callback |
| 26 |
.SH SYNOPSIS |
| 27 |
#include <curl/curl.h> |
| 28 |
|
| 29 |
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_WRITEDATA, void *pointer); |
| 30 |
.SH DESCRIPTION |
| 31 |
A data \fIpointer\fP to pass to the write callback. If you use the |
| 32 |
\fICURLOPT_WRITEFUNCTION(3)\fP option, this is the pointer you'll get in that |
| 33 |
callback's 4th argument. If you don't use a write callback, you must make |
| 34 |
\fIpointer\fP a 'FILE *' (cast to 'void *') as libcurl will pass this to |
| 35 |
\fIfwrite(3)\fP when writing data. |
| 36 |
|
| 37 |
The internal \fICURLOPT_WRITEFUNCTION(3)\fP will write the data to the FILE * |
| 38 |
given with this option, or to stdout if this option hasn't been set. |
| 39 |
|
| 40 |
If you're using libcurl as a win32 DLL, you \fBMUST\fP use a |
| 41 |
\fICURLOPT_WRITEFUNCTION(3)\fP if you set this option or you will experience |
| 42 |
crashes. |
| 43 |
.SH DEFAULT |
| 44 |
By default, this is a FILE * to stdout. |
| 45 |
.SH PROTOCOLS |
| 46 |
Used for all protocols. |
| 47 |
.SH EXAMPLE |
| 48 |
A common technique is to use the write callback to store the incoming data |
| 49 |
into a dynamically growing allocated buffer, and then this |
| 50 |
\fICURLOPT_WRITEDATA(3)\fP is used to point to a struct or the buffer to store |
| 51 |
data in. Like in the getinmemory example: |
| 52 |
https://curl.haxx.se/libcurl/c/getinmemory.html |
| 53 |
.SH AVAILABILITY |
| 54 |
Available in all libcurl versions. This option was formerly known as |
| 55 |
\fICURLOPT_FILE\fP, the name \fICURLOPT_WRITEDATA(3)\fP was introduced in |
| 56 |
7.9.7. |
| 57 |
.SH RETURN VALUE |
| 58 |
This will return CURLE_OK. |
| 59 |
.SH "SEE ALSO" |
| 60 |
.BR CURLOPT_WRITEFUNCTION "(3), " CURLOPT_READDATA "(3), " |