code: вариант
Этот коммит содержится в:
12
main.cpp
12
main.cpp
@@ -61,14 +61,18 @@ Input download(const string& address)
|
||||
stringstream buffer;
|
||||
CURL* curl = curl_easy_init();
|
||||
if(curl) {
|
||||
CURLcode res;
|
||||
CURLcode res,res1;
|
||||
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);
|
||||
if (res != 0){
|
||||
cout << curl_easy_strerror(res);
|
||||
exit(1);
|
||||
if (!res){
|
||||
double speed;
|
||||
res1 = curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed);
|
||||
if(!res1){
|
||||
cout << "Upload speed bytes/sec\n" << speed;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user