diff --git a/LABA1.cpp b/LABA1.cpp index 1d61138..f01e5bb 100644 --- a/LABA1.cpp +++ b/LABA1.cpp @@ -98,7 +98,7 @@ size_t write_data(void* items, size_t item_size, size_t item_count, void* ctx) { size_t write_header(char* buffer, size_t size, size_t nitems, void* userdata) { - cerr << "Headers: " << buffer << endl; + //cerr << "Headers: " << buffer << endl; return size * nitems; } @@ -108,8 +108,10 @@ static size_t progress_callback(void* clientp, double ultotal, double ulnow) { - struct progress* memory = (progress*)clientp; - cerr << "Progress: " << (dlnow / dltotal) * 100 << "%\n"; + //struct progress* memory = (progress*)clientp; + if (!isnan((dlnow / dltotal) * 100.0)) { + cerr << "Progress: " << (double)(dlnow / dltotal) * 100.0 << "%\n"; + } //cerr << "Progress: " << memory->privat << "\n"; return 0; /* all is good */ } @@ -122,13 +124,13 @@ Input download(const string& address) { if (curl) { CURLcode res; curl_easy_setopt(curl, CURLOPT_URL, address.c_str()); - curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer); curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &data); - curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback); curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, write_header); curl_easy_setopt(curl, CURLOPT_HEADERDATA, NULL); + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L); + curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback); res = curl_easy_perform(curl); curl_easy_cleanup(curl); if (res != CURLE_OK) { diff --git a/LABA1.vcxproj b/LABA1.vcxproj index 75da246..cdd07d1 100644 --- a/LABA1.vcxproj +++ b/LABA1.vcxproj @@ -104,7 +104,7 @@ true _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - C:\Users\gorda\Desktop\laba\LABA4\newlaba\curlic\include;%(AdditionalIncludeDirectories) + C:\Users\gorda\OneDrive\Рабочий стол\LABA\LABA4\cs-lab34\curlic\include;C:\Users\gorda\Desktop\laba\LABA4\newlaba\curlic\include;%(AdditionalIncludeDirectories) libcurl.dll.a;%(AdditionalModuleDependencies)