cURL / Mailing Lists / curl-library / Single Mail

curl-library

Help with C and curl

From: <pppsss7_at_gmail.com>
Date: Sat, 3 Oct 2009 20:56:40 +0400

Im trying to use libcurl in my C code.
I have low level experience in C, but I try to use it and practice it
with curl lib and without. Ok its lyrics.

I have simple code with libcurl:

#include <curl/curl.h>

int main(void)
{
   CURL *curl;
   CURLcode res;
   char errbuf[CURL_ERROR_SIZE],result;

   curl = curl_easy_init();
   if(curl) {
     curl_easy_setopt(curl, CURLOPT_URL, 'server');
     curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf);
     curl_easy_setopt(curl, CURLOPT_NOBODY, 1);
     res = curl_easy_perform(curl);
     if(res != 0){
       printf("%s\n", errbuf);
     } else {
       curl_easy_getinfo(curl,CURLINFO_CONTENT_TYPE,&result);
       printf("%c\n", result);
     }
     /* always cleanup */
     curl_easy_cleanup(curl);
   }
   return 0;
}

       printf("%c\n", result); the string return abra-kadabra
What's wrong ? I try tu use %s and nothing true again.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-10-03