lab4 обработка ошибок curl

master
Dmitriy (BerezhkovDA) 12 месяцев назад
Родитель 246858e696
Сommit 0aaa906977

@ -29,12 +29,19 @@ Input input_data(istream& in,bool prompt)
} }
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
if (argc > 1) { if (argc > 1)
{
CURL* curl = curl_easy_init(); CURL* curl = curl_easy_init();
if (curl) { if (curl)
{
CURLcode res; CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, argv[1]); curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
res = curl_easy_perform(curl); res = curl_easy_perform(curl);
if (res != CURLE_OK)
{
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
exit(1);
}
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
cout << res <<endl ; cout << res <<endl ;
} }

Загрузка…
Отмена
Сохранить