From d9a2b3648aa783b89b2f081d86c0a12b608a9eb7 Mon Sep 17 00:00:00 2001 From: "Varvara (ZeninaVA)" Date: Wed, 21 May 2025 16:28:29 +0300 Subject: [PATCH] =?UTF-8?q?code:=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index f4cf7f2..02bd14c 100644 --- a/main.cpp +++ b/main.cpp @@ -7,7 +7,6 @@ using namespace std; - struct Input { vector vec; size_t korz{}; @@ -43,20 +42,27 @@ int main(int argc, char* argv[]) { curl_global_init(CURL_GLOBAL_ALL); if (argc > 1) { - const char *url = argv[1]; CURL *curl = curl_easy_init(); if (curl) { curl_easy_setopt(curl, CURLOPT_URL, url); - curl_easy_perform(curl); + + CURLcode res = curl_easy_perform(curl); + if (res != CURLE_OK) { + cerr << "curl_easy_perform() failed: " << curl_easy_strerror(res) << endl; + exit(1); + } + curl_easy_cleanup(curl); } return 0; } + auto in_with_prompt = input_data(cin, true); auto bins_with_prompt = make_histogram(in_with_prompt.korz, in_with_prompt.vec); show_histogram_svg(bins_with_prompt); return 0; +}