cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: FW: HTTP GET using easycurl - HTTP chunks in HTTP response.

From: James Dennett <jdennett_at_technocom-wireless.com>
Date: Thu, 14 Dec 2006 13:25:28 -0800

> -----Original Message-----
> From: curl-library-bounces_at_cool.haxx.se [mailto:curl-library-
> bounces_at_cool.haxx.se] On Behalf Of Rangoli Mathur
> Sent: Thursday, December 14, 2006 7:24 AM
> To: libcurl development
> Subject: RE: FW: HTTP GET using easycurl - HTTP chunks in HTTP
response.
>
>
>
[snip]

> This is what the entire test program looks like.
> In write_data function I am just gathering the data, so I can see the
> response after the perform call returns.
>
> #include <curl/curl.h>
> #include <curl/types.h>
> #include <curl/easy.h>
> #include <iostream>
>
>
> using namespace std;
>
> string strData = "";
>
> size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream)
> {
> strData += ((char*) ptr);
> return (nmemb * size);
> }

I think you meant something more like
  strData.append((char*)ptr, size*nmemb)
to append the correct number of bytes to strData, no?

-- James
Received on 2006-12-14