cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Binary data

From: Sigal Algranaty <sigala_at_itemfield.com>
Date: Sun, 6 Apr 2003 17:14:12 +0200

Thanks a lot.
Just did it thanks to Daniel's answer, and it's working.

-----Original Message-----
From: curl-library-admin_at_lists.sourceforge.net
[mailto:curl-library-admin_at_lists.sourceforge.net] On Behalf Of James
Bursa
Sent: Sunday, April 06, 2003 3:56 PM
To: curl-library_at_lists.sourceforge.net
Subject: Re: Binary data

In message <4393C0667850D4118CE600508BFC91F359E47A_at_SERVER1> you wrote:

> size_t write_callback(void *buffer,
> size_t size,
> size_t nitems,
> void *userp)
> {
> FILE *file = (FILE *)userp;
> size_t write;
> size *= nitems;
> write = fwrite(buffer, size, nitems, file);
> return size;
> }

You're writing (size * nitems * nitems) bytes to the file instead of
just (size * nitems). Try removing the line

size *= nitems;

and replacing 'return size' with 'return write'.

James

-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb:
Dedicated Hosting for just $79/mo with 500 GB of bandwidth!
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/

-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb:
Dedicated Hosting for just $79/mo with 500 GB of bandwidth!
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
Received on 2003-04-06