curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Couple cuestions about CURLOPT_WRITEFUNCTION callback

From: David Requena <drequena_at_gmail.com>
Date: Mon, 13 Feb 2017 18:25:57 +0100

2017-02-13 15:27 GMT+01:00 Patrick Monnerat <patrick_at_monnerat.net>:

>
>
> On 02/13/2017 02:47 PM, David Requena wrote:
>
>>
>> When I call fwrite I know what the written items are, what their size is,
>> and how many of them there are. When in a callback I know how many items
>> I'm receiving and their sizes, but not what they are, unless specified in
>> the documentation.
>>
>> You probably know (in your mind and your program) what is the size of
> each item and how many you are EXPECTING, but not how many are PROVIDED by
> this call to your callback: Libcurl itself is generic and thus knows the
> later, but cannot know the formers.
> As you have noted, this prototype signature allows having fwrite as a
> direct callback: this is so only for convenience and, by now, libcurl
> always sets size to 1 in calls, since it cannot not know your data
> structure.
> And you DO have nmemb bytes of received data in the buffer, although not
> all expected data may be present at once.
>

Exactly what I understood, thanks for elaborating

-- 
Saludos / Regards,
David Requena

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-02-13