cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: question regarding CURLOPT_WRITEFUNCTION & CURLOPT_WRITEDATA

From: Jan <haihappn_at_gmail.com>
Date: Wed, 22 Oct 2008 10:27:53 +0200

2008/10/21 Ralph Mitchell <ralphmitchell_at_gmail.com>
On Tue, Oct 21, 2008 at 6:22 AM, Jan <haihappn_at_gmail.com> wrote:

>
> FILE *p;
     p=fopen("/tmp/image.png", "w");
     fwrite(chunk.memory, sizeof (char), chunk.size, p);
     fclose(p);

The md5sum of the new file, /tmp/image.png, exactly matches the original and
it displays just fine. Seems to me like getinmemory.c does a fine job of
grabbing a binary file.

You are right. with fwrite it works, but not with fputs..

2008/10/22 Mohun Biswas <m_biswas_at_mailinator.com>

>
> The OP appears to be using Windows (based on mention of "dll") in which
> case it may be a text/binary problem. I.e. the fopen would have to use "wb"
> instead of just "w".

Thats right, im using windows and built libcurl als dynamic dll. anyway, i
already had specified "wb".
Received on 2008-10-22