cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: passing state in write callbacks

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 15 Sep 2011 23:23:15 +0200 (CEST)

On Thu, 15 Sep 2011, Alex Loukissas wrote:

>> Why can't you just use the existing void * argument?
>
> Correct me if I'm wrong, but doesn't this contain the data read by curl to
> be written to the file? At least this is what's passed onto fwrite( ).

http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTWRITEFUNCTION

And the quote from the above link:

   "Set the userdata argument with the CURLOPT_WRITEDATA option"

IOW: no, you set that pointer yourself to whatever you want. It is only if you
don't use the callback it should be a FILE *.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-09-15