cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: write callback issues (was Re: A new problem)

From: Prasad J Pandit <prasad.pandit_at_comat.com>
Date: Fri, 4 Apr 2008 16:36:31 +0530 (IST)

On Fri, 4 Apr 2008, Linus Nielsen Feltzing wrote:
> I think we need to see more of your code to help you here, not only the
> callback code.

   Well, this is what I do before calling curl_easy_perform()

CURLCode rcode;
char str[1024];

curl_global_init (CURL_GLOBAL_WIN32);
if (!(gcurl = curl_easy_init()))
         return -1;

curl_easy_setopt (gcurl, CURLOPT_WRITEFUNCTION, recv_data);
curl_easy_setopt (gcurl, CURLOPT_WRITEDATA, (void *)&grsp);

curl_easy_setopt (gcurl, CURLOPT_URL, "http://10.0.1.1:9999/");

memset (str, '\0', sizeof (str));
_snprintf (str, sizeof (str), "user=%s", uname));
curl_easy_setopt (gcurl, CURLOPT_POSTFIELDS, str);

rcode = curl_easy_perform (gcurl);
MessageBox (NULL, convert_to_wchar (itoa((int)rcode, str, 10)), TEXT ("CURLCode-1"), MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);

   ...

curl_easy_cleanup (gcurl);

Does that help?

--
Regards
   - Prasad
Received on 2008-04-04