I have a class with method send which will use curl to send something and handlehdr is the callback function for receiving the headers. curl_easy_setopt doesn't accept non static methods as callback.
I can make it static member but i want to access the data members of class A inside header_callback. How do i do this?
Should i have this header_callback method outside the class and create instance of class A inside that method to access its members? Since this method is callback inside class A's method (send), is there any other way to do this?
class A
{
public:
int a;
string str;
-------
------
void send();
size_t header_callback(char *buffer, size_t size,
size_t nitems, void *userdata);
}
Actually i have another structure which holds some info as HEADERDATA, i think i can have &a as one of the fileds in that structure. Thank you so much.