cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Writing data to a char buffer instead of a file

From: Yuriy Sosov <yusosov_at_gmail.com>
Date: Wed, 14 May 2008 11:55:05 -0400

- After the Daniel's response, I gave it another thought and I now I
think it is not worth adding it as a feature if this functionality was
not intended to be there by design.
- I think it is a good idea though to provide an example of an
efficient call back function in the documentation. My idea is that an
efficient one would allocate memory in chunks as needed to save the
response pieces during curl_easy_perform. After curl_easy_perform is
over the whole response can be copied from the small chunks in one
step.

On Wed, May 14, 2008 at 10:34 AM, Tim Tassonis <timtas_at_cubic.ch> wrote:
> Hi Daniel
>
> Daniel Stenberg wrote:
>>
>> On Tue, 13 May 2008, Yuriy Sosov wrote:
>>
>>> I need the the output in a char buffer and not a file. I also want it to
>>> be fast. I can implement it in a callback function, but it would be better
>>> though if it was a standard feature.
>>
>> Why so? The callback is the standard feature and there are probably
>> hundreds of applications out there that use it to store the received data in
>> memory instead of to a file.
>
> Exactly, hundreds of application each implementing the more or less same
> functionality over and over again....
>
> I've been doing this as well, and really think such a function would
> actually be useful, as it is a standard requirement to store the result of
> request in a buffer instead of a file.
Received on 2008-05-14