From 08cd86905762e57230d8baacc8e1c51a2ba20b32 Mon Sep 17 00:00:00 2001 From: MamakinYR Date: Sun, 19 May 2024 23:59:45 +0300 Subject: [PATCH] =?UTF-8?q?code:=20=D0=A0=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20?= =?UTF-8?q?=D1=81=20curl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lab1.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lab1.cpp b/lab1.cpp index fb4e98a..743d50d 100644 --- a/lab1.cpp +++ b/lab1.cpp @@ -32,12 +32,26 @@ Input input_data(istream& in_stream, bool prompt) { return in; } -int main() +int main(int argc, char* argv[]) { + if (argc > 1) { + CURL* curl = curl_easy_init(); + if (curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, argv[1]); + res = curl_easy_perform(curl); + if (res != 0) { + cerr << curl_easy_strerror(res); + exit(1); + } + } + curl_easy_cleanup(curl); + return 0; + } curl_global_init(CURL_GLOBAL_ALL); const size_t SCREEN_WIDTH = 80; const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1; - auto in = input_data(cin, true); + auto in = input_data(cin, false); vector numbers_data = in.numbers; auto bins = make_histogram(in.numbers, in.bin_count); show_histogram_svg(bins, in.numbers, in.bin_count);