cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: sepheaders.c

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 5 Mar 2008 12:52:46 +0100 (CET)

On Wed, 5 Mar 2008, Ingo Krabbe wrote:

> I found a problem within the example "docs/examples/sepheaders.c", which
> confused me a bit: The example promises to write header and content into
> different files, "header.out" and "body.out". Both files are opened but
> only the "header.out" file will be written to, since this is the only one
> assigend.
>
> The body output will be written to stdout (or is it stderr?).

There's a rather big comment in that example source code that says:

   /*
    * Notice here that if you want the actual data sent anywhere else but
    * stdout, you should consider using the CURLOPT_WRITEDATA option. */

I don't remember why this sample doesn't do it by itself, but you can probably
get away with simply adding:

   curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, bodyfile);

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2008-03-05