c++ - libcurl crashing program after execution? -
i using libcurl make request google server. curl library giving output , when use curl variables global every thing works fine when using curl variables local inside function or class private members program crashes. not able catch segmentaion fault occuring.
code is
void func1(); { internet_connection_through_curl internet_connection; internet_connection.simple_program(querry_url); } internet_connection_through_curl::simple_program(string url) { curl *curle; curlcode rese; curle = curl_easy_init(); if(curle) { curl_easy_setopt(curle, curlopt_url, url.c_str()); curl_easy_setopt(curle, curlopt_followlocation, 1l); curl_easy_setopt(curle, curlopt_ssl_verifypeer, 0l); curl_easy_setopt(curle, curlopt_ssl_verifyhost, 0l); curl_easy_setopt(curle, curlopt_writedata , (void *)(&uf)); curl_easy_setopt(curle, curlopt_writefunction, writememorycallback); curl_easy_setopt(curle, curlopt_headerfunction, headermemorycallback); rese = curl_easy_perform(curle); fprintf(stderr , "curl easy perform error----> %s\n" , curl_easy_strerror(rese)); if(rese != curle_ok) fprintf(stderr, "curl_easy_perform() failed: %s\n",curl_easy_strerror(rese)); curl_easy_cleanup(curle); } }
Comments
Post a Comment