curl-library
Re: How to avoid static function in c++ when calling CURLOPT_WRITEFUNCTION
Date: Thu, 25 Sep 2008 09:07:02 +0200
Hello again im trying to understand what is done in the PAQ example
but with no much lack
here is my code :
void Http::writer(void *buffer, size_t size, size_t nmemb,void* f)
{
// Call non-static member function.
static_cast<Http*>(f)->setBuffer(buffer,size,nmemb);
}
here i like to set my member function with the buffer data but it is empty .
int Http::setBuffer(void *buffer, size_t size, size_t nmemb)
{
// What we will return
int result = 0;
// Is there anything in the buffer?
if (buffer!=NULL)
{
// Append the data to the buffer
m_mybuffer->append(buffer, size * nmemb);
// How much did we write?
result = size * nmemb;
}
return result;
}
what am i doing wrong here
Thanks
On Wed, Sep 24, 2008 at 1:44 PM, Meir Yanovich <meiry242_at_gmail.com> wrote:
> Thanks allot
> i will try to implement this
>
> On Wed, Sep 24, 2008 at 1:42 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
>> On Tue, 23 Sep 2008, Stephen Collyer wrote:
>>
>>> I've posted more details about this in past so if you search the list you
>>> should find all you need to know.
>>
>> I also (finally) added this section to the FAQ:
>>
>> http://curl.haxx.se/docs/faq.html#Using_C_non_static_functions_f
>>
>> --
>>
>> / daniel.haxx.se
>>
>
Received on 2008-09-25