cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Problem setting CURLOPT_WRITEDATA to NULL

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Fri, 23 Jul 2010 11:33:24 -0700

On Fri, Jul 23, 2010 at 02:48:00PM +0100, Simon Elliott wrote:
> I get an error in curl_easy_perform() when I set the CURLOPT_WRITEDATA
> option to NULL or zero on win32. I need to do this because I've previously
> set it to data for a callback.
>
> In debug mode this gives an assertion failure in sendf.c. In release mode
> it just crashes. The problem doesn't happen if I comment out the
> CURLOPT_WRITEDATA call.

Just where do you expect the data to go in that case? The default write
callback function is fwrite, so if you set WRITEDATA to NULL, fwrite will
attempt to write to a NULL file handle. Note also this line in the
documentation:

  If you're using libcurl as a win32 DLL, you MUST use the
  CURLOPT_WRITEFUNCTION if you set this option [CURLOPT_WRITEDATA]
  or you will experience crashes.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-07-23