cURL / Mailing Lists / curl-users / Single Mail

curl-users

response data received from server

From: Jerry G. Chiuan <jerry_at_oridus.com>
Date: Wed, 10 Sep 2003 17:05:57 -0700

Hi All,
I would like to have my own callback function invoked by curl once the data is received from server side
And, I have a class called A

Class A {
::
public:
    setBuffer(char *buf) { m_buf = buf; }
    setBufSize(const int m_size) { m_size = size; )

private:
char * m_buf;
int m_size;
::
}

can I just simply point m_buf to the data received from server, like this

size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data) {
    ::
    setBuffer(ptr);
    setBufSize(size);
    ::
}

Then I can manipulate the data via A.

- is it doable? or I have to "copy" the data into my buffer? how long does the data would be "alive"? when the data would be deleted?
- Furthermore, who needs to delete the data? curl would do it?

Basically, what I want is curl simply doesn't delete the data, then we can delete the data once we know we won't use it anymore.

- Jerry

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-09-11