1     double zipsize = 0;
 2     CURL *handle = curl_easy_init();
 3     curl_easy_setopt(handle, CURLOPT_URL, url);
 4     curl_easy_setopt(handle, CURLOPT_HEADER, 1);   //只需要header头
 5     curl_easy_setopt(handle, CURLOPT_NOBODY, 1);   //不需要body
 6 
 7     if (curl_easy_perform(handle) == CURLE_OK)
 8     {
 9      curl_easy_getinfo(handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &zipsize);
10         packageBytesTotal = (int)((zipsize / 1000) + 0.5);
11         std::cout << "当前要加载的包大小为: " << packageBytesTotal << "KB" << std::endl;
12     }
13     curl_easy_cleanup(handle);

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-21
  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-11
  • 2022-01-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案