lab4
KhodiukMR 11 месяцев назад
Родитель ad6f1b498a
Сommit 0a581db92f

@ -57,9 +57,8 @@ Download(const string& address, const string& option) {
} }
CURL* curl = curl_easy_init(); CURL* curl = curl_easy_init();
if (curl) { if (curl) {
CURLcode res; CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, address.c_str()); curl_easy_setopt(curl, CURLOPT_URL, (option == "" || option == "-verbose") ? address.c_str() : option.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteData); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteData);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
if (address == "-verbose" || option == "-verbose") { if (address == "-verbose" || option == "-verbose") {
@ -85,7 +84,13 @@ int main(int argc, char* argv[]) {
double MaxCount = 0; double MaxCount = 0;
Input in; Input in;
if (argc > 1) { if (argc > 1) {
in = Download(argv[1], argv[2]); if (argc == 2) {
in = Download(argv[1], "");
}
else {
in = Download(argv[1], argv[2]);
}
} }
else { else {
in = InputData(cin, true); in = InputData(cin, true);

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