rendered paste bodystd::ofstream& OasE::downloadFile(static char url[150]){
CURL *curl;
curl = curl_easy_init();
std::ofstream file;
string content;
using namespace std;
file.open("c:/test.pdf", ios::binary);
if(curl != NULL){
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER,m_errorBuffer);
curl_easy_setopt(curl, CURLOPT_URL,url);
curl_easy_setopt(curl, CURLOPT_HEADER,0);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &OasE::writeToFileStream);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &file);
//curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
}
int result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if (result == CURLE_OK) {
std::cout << "REQUEST OK";
}
file.close();
return file;
}