ShirokovIV 4 дней назад
Родитель de1785831e
Сommit 43e4142deb

@ -23,21 +23,17 @@ Input input_data(istream& in, bool promt = false) {
in >> lin.korz; in >> lin.korz;
return lin; return lin;
} }
size_t write_data(void* ptr, size_t size, size_t nmemb, void* stream) {
size_t written = fwrite(ptr, size, nmemb, stdout);
return written;
}
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) {
curl_easy_setopt(curl, CURLOPT_URL, argv[1]); curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
CURLcode res = curl_easy_perform(curl); CURLcode res = curl_easy_perform(curl);
if (res != CURLE_OK) { if (res != CURLE_OK) {
cerr << "cURL error: " << curl_easy_strerror(res) << endl; cerr << "cURL error: " << curl_easy_strerror(res) << endl;
exit(1);
} }
curl_easy_cleanup(curl); curl_easy_cleanup(curl);

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