On Sat, 30 Jun 2012 23:49:51 +0200, Nrgyzer <nrgy...@gmail.com> wrote:

Hi guys,

I know... there's a lib for curl but I'm using an old CURL-binding for D... I've the following problem: I'm sending my login data to a web page and I want store the response of curl_easy_perform() in a string. So I'm using the following few lines to do that:

string temp;

size_t callback(char* ptr, size_t size, size_t, nmemb, string* stream) {
   temp ~= *ptr;
   // or: How can I append ptr to my stream?
// When I use '*stream ~= cast(char) ptr;' I get an memory violation...
}


Wild guess without knowing curl:

temp ~= *ptr; will add the first character of ptr to temp.
Is ptr zero terminated?
You can convert a pointer to an array by using the slice syntax:
temp ~= ptr[0..size]; // assuming size is the number of elements in ptr

Reply via email to