I'm new to libcurl and trying to get output of sample program codes, but no result.
Code:
#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, "http://google.com");
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
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.