cURL / Mailing Lists / curl-library / Single Mail

curl-library

help on the sample???

From: <pit_at_paradise.net.nz>
Date: Thu, 1 Feb 2001 22:50:38 GMT

Hi this is my code.

Modified for Windows from the sample code.

I used copy of win32_init() and win32_cleanup to load/free
winsock.dll. Also copied 'write_data()' from the second example.

After the execution "dumpit.out" contains correct headerfile
but i keep getting '23' for returned value of 'res'.

I'm not quite sure what's going on.....

Can anyone give me some clue?

void __fastcall TForm1::dowork(){
  CURL *curl;
  CURLcode res;
  FILE *headerfile;

  win32_init();

  headerfile = fopen("dumpit.out", "w");

  curl = curl_easy_init();

  if(curl) {
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);

    /* what call to write: */
    curl_easy_setopt(curl, CURLOPT_URL, "www.netscape.com");
    curl_easy_setopt(curl, CURLOPT_WRITEHEADER, headerfile);
    res = curl_easy_perform(curl);

    if (res == 0) {
        ShowMessage("GOOD");
    } else {
        ShowMessage(res);
    }
    /* always cleanup */
    curl_easy_cleanup(curl);
  }
  return;
}

_______________________________________________
Curl-library mailing list
Curl-library_at_lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/curl-library
Received on 2001-02-02