CURLOPT_PROGRESSFUNCTION what these parameters mean?

坚强是说给别人听的谎言 提交于 2019-12-10 12:21:56

问题


In libcurl, what the parameters mean in the function called by setting CURLOPT_PROGRESSFUNCTION?

int function(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);

Its a lame question I know but the website doesn't seem to describe, or I wasn't able to find :(


回答1:


This example might help. To summarize:

int function(
  void *clientp,  // this is an unchanged pointer as set with CURLOPT_PROGRESSDATA
  double dltotal, // the total bytes to be downloaded (or 0 if not downloading)
  double dlnow,   // the current download bytecount (or 0 if not downloading)
  double ultotal, // the total bytes to be uploaded (or 0 if not uploading)
  double ulnow);  // the current upload bytecount (or 0 if not uploading)

See CURLOPT_PROGRESSDATA for clientp. If you return any value other than 0 from the callback, the transfer will be cancelled.



来源:https://stackoverflow.com/questions/13657630/curlopt-progressfunction-what-these-parameters-mean

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!