Добавил проверку ошибок

Этот коммит содержится в:
Stepan Siniavskii
2023-06-05 11:16:07 +03:00
родитель d25177cf18
Коммит 3818146131

Просмотреть файл

@@ -38,10 +38,19 @@ input_data(istream& inn, bool promt) {
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL);
if (argc > 1){ if (argc > 1)
cout << argc << endl; {
for(size_t i = 0; i < argc; i++){ CURL *curl = curl_easy_init();
cout << "argv[" << i << "] = " << argv[0] << endl; 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){
cout << curl_easy_strerror;
exit(1);
}
} }
return 0; return 0;
} }