cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_WRITEFUNCTION Callback

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 21 Feb 2010 14:46:38 +0100 (CET)

On Sat, 20 Feb 2010, David Haugh wrote:

> curl_easy_setopt(d, CURLOPT_URL, finalURL);
> curl_easy_setopt(d, CURLOPT_WRITEFUNCTION, NULL);
> curl_easy_setopt(d, CURLOPT_WRITEDATA, fp);
> curl_easy_setopt(d, CURLOPT_USERAGENT, "Mozilla/4.0");

> The curl_easy_setopt docs for CURLOPT_WRITEFUNCTION say: Set this option to
> NULL to get the internal default function. The internal default function
> will write the data to the FILE * given with CURLOPT_WRITEDATA. So shouldn't
> it be writing whatever it gets from finalURL to fp? Because the file pointed
> to by fp is completely blank no matter what the inputs to the program are.

CURLOPT_WRITEFUNCTION set to NULL just puts it to the internal default, so in
this case it has no actual effect since it already was at default.

To debug, I suggest you start with enabling CURLOPT_VERBOSE and you check the
return code from curl_easy_perform().

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-02-21