Сравнить коммиты
2 Коммитов
75c4b02d7f
...
main
| Автор | SHA1 | Дата | |
|---|---|---|---|
| b2ec2b1bd9 | |||
| 6ebc5ea258 |
10
main.cpp
10
main.cpp
@@ -40,6 +40,8 @@ download(const string& address) {
|
|||||||
if(curl) {
|
if(curl) {
|
||||||
CURLcode res;
|
CURLcode res;
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, address);
|
curl_easy_setopt(curl, CURLOPT_URL, address);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, input_data);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
|
||||||
res = curl_easy_perform(curl);
|
res = curl_easy_perform(curl);
|
||||||
if(res!=0){
|
if(res!=0){
|
||||||
cout << curl_easy_strerror(res) << endl;
|
cout << curl_easy_strerror(res) << endl;
|
||||||
@@ -50,6 +52,14 @@ download(const string& address) {
|
|||||||
return input_data(buffer, false);
|
return input_data(buffer, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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<stringstream*>(ctx);
|
||||||
|
buffer->write(reinterpret_cast<char*>(items), data_size);
|
||||||
|
return data_size;
|
||||||
|
}
|
||||||
|
|
||||||
Input input_data(istream& in, bool promt) {
|
Input input_data(istream& in, bool promt) {
|
||||||
|
|
||||||
Input input_struct;
|
Input input_struct;
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user