cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl appends weird junk to downloaded file

From: kryptech <webmaster_at_kryptech.net>
Date: Sat, 18 Jun 2005 19:55:13 -0500

On Sun, 2005-06-19 at 00:45 +0200, Daniel Stenberg wrote:
> On Sat, 18 Jun 2005, kryptech wrote:
>
> > static size_t write_data(void *ptr, size_t size, size_t nmemb, void
> > *data)
> > {
> > int bytesize = size * nmemb;
> > FILE *fp = (FILE *) data;
> >
> > fprintf(fp, "%s", (char*) ptr);
>
> Don't assume that you get the data passed to the write callback zero
> terminated.
hmm... it seems the libcurl callbacks are made with fwrite in mind ;) thanks a lot guys, I wouldve never guessed that.
Received on 2005-06-19