On Fri, 17 Aug 2012, Saravana kumar wrote:

the exported function returns CURLCode 23, which was
write function error! Am i missing anything?

Yes. You forgot to read the docs properly....

/* the function to invoke as the data recieved */
size_t static write_callback_func(void *buffer, size_t size, size_t
nmemb, void *userp)
{
   char **response_ptr =  (char**)userp;

   /* assuming the response is a string */
   *response_ptr = strndup(buffer, (size_t)(size *nmemb));
}

First, didn't your compiler warn you about not returning anything from this function?

Then, a little clue from http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTWRITEFUNCTION:

 "Return the number of bytes actually taken care of. If that amount differs
  from the amount passed to your function, it'll signal an error to the
  library. This will abort the transfer and return CURLE_WRITE_ERROR."

--

 / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to