From 283c812736dca37bb5baf4edbabf8ce0da683992 Mon Sep 17 00:00:00 2001 From: "Andrew (ShabatovAA)" Date: Mon, 20 May 2024 01:06:23 +0300 Subject: [PATCH] =?UTF-8?q?code:=20=D0=B2=D0=B0=D1=80=D0=B8=D0=B0=D0=BD?= =?UTF-8?q?=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index 6109359..19754a6 100644 --- a/main.cpp +++ b/main.cpp @@ -61,14 +61,18 @@ Input download(const string& address) stringstream buffer; CURL* curl = curl_easy_init(); if(curl) { - CURLcode res; + CURLcode res,res1; curl_easy_setopt(curl, CURLOPT_URL, address.c_str()); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer); res = curl_easy_perform(curl); - if (res != 0){ - cout << curl_easy_strerror(res); - exit(1); + if (!res){ + double speed; + res1 = curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed); + if(!res1){ + cout << "Upload speed bytes/sec\n" << speed; + exit(1); + } } curl_easy_cleanup(curl); }