From 860cb1779f584978c72fae9d1a12286115b9aae6 Mon Sep 17 00:00:00 2001 From: "Igor (ZharkovIG)" Date: Sat, 26 Oct 2024 16:18:03 +0300 Subject: [PATCH] =?UTF-8?q?code:=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=20curl=5Feasy=5Fi?= =?UTF-8?q?nit()=20=D0=B8=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=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 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index abb657b..52948b9 100644 --- a/main.cpp +++ b/main.cpp @@ -33,11 +33,20 @@ 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; + 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); + curl_easy_cleanup(curl); + if (res != CURLE_OK) { + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + exit(1); + } } + return 0; } auto in = input_data(cin, false); auto bins = make_histogram(in.numbers, in.bin_count);