Witam to znowu ja :(
Mam problem z curl. Mam taka funkcje która wywołuje po kliknięciu w przycisk
string loadPage(string url){
static char CURL_errorBuffer[CURL_ERROR_SIZE];
static string CURL_buffer;
CURL *curl;
CURLcode CURL_result;
curl = curl_easy_init();
if(curl){
// Now set up all of the curl options
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, CURL_errorBuffer);
curl_easy_setopt(curl, CURLOPT_HEADER, 0);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writer);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &CURL_buffer);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
// Attempt to retrieve the remote page
CURL_result = curl_easy_perform(curl);
// Always cleanup
curl_easy_cleanup(curl);
// Did we succeed?
if (CURL_result == CURLE_OK){
cout << "http -- " << CURL_buffer << "\n";
}else{
//cout << "Error: [" << CURL_result << "] - " << CURL_errorBuffer;
//MessageBox( NULL, CURL_errorBuffer, "CURL ERROR", MB_ICONEXCLAMATION );
}
}else{
CURL_buffer = "jakis blad";
}
delete(curl);
//delete(&CURL_buffer);
delete(&CURL_result);
//delete(CURL_buffer);
return CURL_buffer;
}
wszystko ladnie dziala i w ogole jest super tylko gdy klikne jeszcze raz w przycik moj program sie zawiesza... mozecie mi cos poradzic na ten temat?