curl-library
Re: a problem getting things back through url connection
Date: Fri, 10 Aug 2001 08:06:14 +0000
Li Chen wrote:
> size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
> {
>
> size_t written;
> written = fwrite(ptr, size, nmemb, stream);
> printf("%s\n",ptr);
> return written;
> }
I assume that the response is too large to fit into the stdio buffer.
Try something like this (warning: the actual code is not tested, but in
principle it should be right)
{
size_t written = 0;
do {
written += fwrite(&((char *)ptr)[written], size, nmemb - written, stream);
} while (written < nmemb);
/* You have to do something similar to the printf statement */
return written;
}
_______________________________________________
Curl-library mailing list
http://curl.haxx.se/libcurl/
Received on 2001-08-10