cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Binary data

From: James Bursa <bursa_at_users.sourceforge.net>
Date: Sun, 06 Apr 2003 14:56:20 +0100

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/
Received on 2003-04-06