cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_WRITEDATA Question

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Tue, 27 Apr 2004 15:31:01 +0200 (CEST)

On Tue, 27 Apr 2004, Guillaume MARTIN wrote:

> I'm under Linux and want to use CURLOPT_WRITEDATA Option
>
> If I understand, I have to make a fopen with "wb" option then pass the "FILE
> *" reference to curl_easy_setopt ?

The pointer you set with CURLOPT_WRITEDATA is the pointer that ends up in the
callback you set with CURLOPT_WRITEFUNCTION.

If you don't set a callback, libcurl has a default "callback" that calls
fwrite() and then you need to pass on a working FILE *, yes.

> Does the curl_easy_perform function waits for the http transfer to finish
> before continuing ?

Yes.

> If yes, The file opened is full with the http response ? Right ?

If you ask for it with CURLOPT_HEADER. You can also opt to get the headers
passed to a different callback with CURLOPT_HEADERFUNCTION.

-- 
     Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
      Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-04-27