From fa48990e3a406caf7da54d2a8df6ace921406e0d Mon Sep 17 00:00:00 2001 From: Andrey Date: Mon, 15 May 2023 20:52:53 +0300 Subject: [PATCH] last before var --- main.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/main.cpp b/main.cpp index dd949d2..b3facc4 100644 --- a/main.cpp +++ b/main.cpp @@ -15,6 +15,17 @@ struct Input size_t bin_count{}; }; +size_t +write_data(void* items, size_t item_size, size_t item_count, void* ctx) +{ + size_t data_size = item_size * item_count; + + stringstream* buffer = reinterpret_cast(ctx); + buffer->write(reinterpret_cast(items), data_size); + + return data_size; +} + Input input_data(istream& in, bool prompt) { @@ -52,6 +63,8 @@ download(const string& address) { cout << curl_easy_strerror(res); exit(1); } + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &buffer); + curl_easy_cleanup(curl); } return input_data(buffer, false);