cURL / Mailing Lists / curl-library / Single Mail

curl-library

Prevent copying of data between curl buffer and user provided buffer

From: Bharath Devanathan <bharathd_at_yahoo-inc.com>
Date: Mon, 10 Oct 2005 18:05:50 -0700

Hello,

When using libcurl to fetch a webpage, I provide it with a write_function
with the signature
"size_t function( void *ptr, size_t size, size_t nmemb, void *stream)"

The webpage is now stored in a buffer pointed to by ptr. To make it really
useful, I end up having to copy the string from the ptr buffer to another
buffer( in this case a std::string).

Is there a way I can avoid making this copy? Ideally I would like to pass a
buffer to libcurl, so that it stores the webpage directly in that buffer.

Thanks in advance,
bharath
Received on 2005-10-11