catching exceptions in C/C++ while using cURL lib catching exceptions in C/C++ while using cURL lib curl curl

catching exceptions in C/C++ while using cURL lib


I'm not a libcurl expert, but don't you need to assign the result of curl_easy_init() to your curl variable before calling the next two curl functions?

ETA, the following code does not throw an exception for me. The curl_easy_perform return is CURLE_COULDNT_RESOLVE_HOST (6).

#include <curl/curl.h>#include <iostream>int main(){    CURL* curl = curl_easy_init();    std::cout << curl_easy_setopt(curl, CURLOPT_URL, "incorrect URL") << std::endl;    std::cout << curl_easy_perform(curl) <<std::endl;}