code: добавил вариант
Этот коммит содержится в:
6
main.cpp
6
main.cpp
@@ -54,6 +54,7 @@ download(const string& address)
|
||||
if(curl)
|
||||
{
|
||||
CURLcode res;
|
||||
double file_size;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, address.c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
|
||||
@@ -63,6 +64,11 @@ download(const string& address)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",curl_easy_strerror(res));
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &file_size);
|
||||
cerr<<"File size: "<<file_size<<" bytes";
|
||||
}
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user