cURL / Mailing Lists / curl-library / Single Mail

curl-library

Win32 curl_easy_setopt( ): CURLOPT_WRITEDATA question

From: Pete Wilson <pete142_at_yahoo.com>
Date: Wed, 17 Feb 2010 04:58:09 -0800 (PST)

From the man pages for curl_easy_setopt( ):

"CURLOPT_WRITEDATA

"Data pointer to pass to the file write function. If you use the CURLOPT_WRITEFUNCTION option, this is the pointer you'll get as input. If you don't use a callback, you must pass a 'FILE *' as libcurl will pass this to fwrite() when writing data.

"The internal CURLOPT_WRITEFUNCTION will write the data to the FILE * given with this option, or to stdout if this option hasn't been set.

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

The final sentence of the paragraph is ambiguous and I want to understand its meaning clearly.

I use libcurl as a DLL under win32. I will always set my CURLOPT_WRITEFUNCTION to NULL. I will always use this (the CURLOPT_WRITEDATA) option; and I will always set it to a FILE *.

I do this because I never want to call fwrite( ). Instead, I want the internal CURLOPT_WRITEFUNCTION always to call fwrite().

But the quoted sentence might mean that I will therefore "experience crashes." So does the warning mean that the internal CURLOPT_WRITEFUNCTION is not useful under win32? IOW, do I always have to implement a CURLOPT_WRITEFUNCTION if my code is running under win32?

Thanks!

-- pete

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