From 36618246522276d239ef83c3a2a7197b60d56ef0 Mon Sep 17 00:00:00 2001 From: MokeevNV Date: Wed, 21 May 2025 21:19:30 +0300 Subject: [PATCH] =?UTF-8?q?code:=20curl=5Feasy=5Finit()=20=D0=B2=D1=8B?= =?UTF-8?q?=D0=B2=D0=BE=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index f06ce8e..1f6cc6d 100644 --- a/main.cpp +++ b/main.cpp @@ -42,16 +42,19 @@ Input input_data(istream& in, bool promt = false) { int main(int argc, char* argv[]) { + curl_global_init(CURL_GLOBAL_ALL); + if(argc > 1) { - cout << "argc = " << argc << endl; - for(int i = 0; i < argc; i++){ - cout << "argv[" << i << "] = " << argv[i] << endl; + CURL *curl = curl_easy_init(); + if(curl) { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, argv[1]); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); } return 0; } - curl_global_init(CURL_GLOBAL_ALL); - auto in = input_data(cin); auto bins = make_histogram(in.numbers, in.bin_count); show_histogram_svg(bins);