Thread: to get output of libcurl program

  1. #1
    Registered User
    Join Date
    Feb 2011

    to get output of libcurl program

    I'm new to libcurl and trying to get output of sample program codes, but no result.
    #include <stdio.h>
    #include <curl/curl.h>
    int main(void)
      CURL *curl;
      CURLcode res;
      curl = curl_easy_init();
      if(curl) {
        curl_easy_setopt(curl, CURLOPT_URL, "");
        res = curl_easy_perform(curl);
        /* always cleanup */ 
      return 0;
    I'm using the following steps:
    To compile: g++ sample.cpp -lcurl -o sample
    To execute: ./sample
    The program is compiled successsfully and after executing it returns to the promt again without showing any output.
    Plz help.

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Katy, Texas
    You need to set up a writer. Look at curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, ....)
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with a Battleship Program
    By HBlakeH in forum C Programming
    Replies: 1
    Last Post: 12-05-2010, 11:13 PM
  2. Replies: 1
    Last Post: 05-29-2010, 05:24 AM
  3. program looping with final output
    By hebali in forum C Programming
    Replies: 24
    Last Post: 02-28-2008, 10:58 AM
  4. Replies: 3
    Last Post: 09-05-2005, 08:57 AM
  5. Redirecting program output straight to an edit control
    By bennyandthejets in forum C++ Programming
    Replies: 5
    Last Post: 07-05-2004, 08:25 AM

Tags for this Thread