curl-library
Re: Doesn't fwrite() return the number of objects written, not the number of bytes?
From: A. Craig West <acraigwest_at_gmail.com>
Date: Thu, 30 Jul 2009 10:52:48 -0400
Date: Thu, 30 Jul 2009 10:52:48 -0400
2009/7/30 Jonathan Wallace <jwallace_at_livetechnology.com>:
> That does seem to be a fundamental flaw with the callback. curl is 20 years
> old I guess when it was created, files that large didn't exist. You are
> correct about fwrite though, it returns the number of elements, not bytes.
Generally I write my fwrite calls to write n elements of 1 byte in
length, so that it will return the number of bytes written. This is
indeed a problem if you ever need to write more than 4 GB of data in
one transaction, and size_t has a 32 bit definition. I can't think of
any use case, particularly with curl, where this would be necessary,
though.
-Craig
Received on 2009-07-30