0

It's my first time working with libcurl. It crashes with the attached errors when it's in

curl_easy_perform(curl);

This is my code:

#include <iostream>
#include <sstream>
#include <string>
#include <curl/curl.h>
using namespace std;


int main(){
curl_global_init(CURL_GLOBAL_ALL);

CURL *curl;
CURLcode res = CURLE_OK;
string content;
string URL = "http://example.com";

curl = curl_easy_init();
if (curl){
    curl_easy_setopt(curl, CURLOPT_URL, URL);
    int res = curl_easy_perform(curl);
    curl_easy_cleanup(curl);

    /*ostringstream out;
    out << res;
    curl_easy_cleanup(curl);
    content = out.str();*/
}
curl_global_cleanup();
return 0;
}

Program: d:\Visual\WebServerCURL\Debug\WebServerCURL.exe File: f:\dd\vctools\crt\crtw32\misc\dbgheap.c Line: 1322

Expression: _CrtIsValidHeapPointer(pUserData)

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Dan R.
  • 638
  • 5
  • 13

0 Answers0