готовый собственный вариант

master
Alex 11 месяцев назад
Родитель 7e907e637c
Сommit 448fb40b4a

@ -60,21 +60,26 @@ Input download(const string& address)
if(curl)
{
CURLcode res;
double start;
curl_easy_setopt(curl, CURLOPT_URL, address.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if (res != 0)
if (res == CURLE_OK)
{
cerr << curl_easy_strerror(res) << endl;
exit(1);
res = curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, &start);
if (CURLE_OK == res)
{
cerr<<"Time: " << start;
}
}
}
curl_easy_cleanup(curl);
curl_easy_cleanup(curl);
return input_data(buffer, false);
return input_data(buffer, false);
}
}
@ -111,11 +116,15 @@ Input download(const string& address)
return 0;
} */
int main(int argc, char* argv[]) {
int main(int argc, char* argv[])
{
Input input;
if (argc > 1) {
if (argc > 1)
{
input = download(argv[1]);
} else {
}
else
{
input = input_data(cin, true);
}

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