cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_multi_perform and write_callback

From: Ray Satiro <raysatiro_at_yahoo.com>
Date: Tue, 18 Nov 2014 01:33:49 -0500

On 11/17/2014 11:15 PM, Jeroen Ooms wrote:
> An additional question: in the getinmemory.c example [1], why does
> realloc allocate 1 byte more than needed and than sets it to 0 at the
> end of the callback? The help page for CURLOPT_WRITEFUNCTION says "The
> data passed to this function will not be zero terminated!". What is
> the benefit of adding a 0 manually?
>
>
> [1] http://curl.haxx.se/libcurl/c/getinmemory.html

Depending on your application and requirements it may be beneficial to
treat the memory as a zero terminated string.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-11-18