#define CURL_STATICLIB
#include <curl\curl.h>
#pragma warning(disable:4996) //_CRT_
size_t write_file(void* ptr, size_t size, size_t nmemb, FILE* stream) {
size_t written = fwrite(ptr, size, nmemb, stream);
return written;
}
int main(void)
{
CURL* curl;
FILE* fp = NULL;
CURLcode res;
printf("simple maps downloader 8==D");
char* addy = "http://link/custommaps.rar";
char OutMe[] = "maps.rar";
curl = curl_easy_init();
if (curl) {
printf("\nDOWNLOADING THE FILES... PLEASE WAIT.");
fp = fopen(OutMe, "wb");
curl_easy_setopt(curl, CURLOPT_URL, addy);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_file);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
int res = curl_easy_perform(curl);
double download = 0;
res = curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD, &download);
double dl = download / 1024;
if(!res){
printf("AVG DL %0.3f kbyte/sec.\n", dl);
}
if (res == CURLE_OK) {
printf("custom maps shizzle is done..\n");
}
else {
printf("failed to download custom maps..");
}
curl_easy_cleanup(curl);
fclose(fp);
}
printf("\n\npress a key to exit..\n");
_getch();
return 0;
}