cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: question regarding CURLOPT_WRITEFUNCTION & CURLOPT_WRITEDATA

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 20 Oct 2008 14:31:31 +0200 (CEST)

On Mon, 20 Oct 2008, Jan wrote:

> WRITEFUNCTION gets chunks of data with a maximum size of
> CURL_MAX_WRITE_SIZE, ptr points to the data of those chunks.
>
> WRITEDATA "collects" all those chunks and writes them to one file.
>
> is this assumption correct?

Yes if you want to. And no if don't want to. WRITEDATA points to a function
callback that you implement so you can decide exactly how you want to deal
with the data libcurl downloads and passes to your function.

Most often I guess you just append that data to a single file or to a single
memory buffer in ram.

> if yes, i have a question: as i read in curl.h it is not wise to change
> CURL_MAX_WRITE_SIZE to a bigger value then 16k.

Well, you can but then you must rebuild libcurl and each transfer will occupy
more memory. Quite probably for very little gain.

> what should i do if i want just one pointer pointing to the whole data of
> the website?

You make sure your callback makes it so. Like the getinmemory.c example!

-- 
  / daniel.haxx.se
Received on 2008-10-20