Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define CURL_STATICLIB
- #include "stdafx.h"
- #include <curl.h>
- #include <types.h>
- #include <easy.h>
- #include <string>
- bool downloadFile(char *url, const char *out) {
- CURL *curl;
- FILE *fp;
- CURLcode res;
- curl = curl_easy_init();
- if (curl) {
- fp = fopen(out, "wb");
- curl_easy_setopt(curl, CURLOPT_URL, url);
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
- curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE);
- curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_func);
- res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
- fclose(fp);
- return true;
- }
- return false;
- }
Add Comment
Please, Sign In to add comment