資源簡介
使用libcurl庫通過http協議下載文件并實時顯示下載進度
代碼片段和文件信息
#include?
#include?“StdAfx.h“
?
size_t?my_write_func(void?*ptr?size_t?size?size_t?nmemb?FILE?*stream)
{
??return?fwrite(ptr?size?nmemb?stream);
}?
?
int?my_progress_func(char?*progress_data
?????????????????????double?t?/*?dltotal?*/
?????????????????????double?d?/*?dlnow?*/
?????????????????????double?ultotal
?????????????????????double?ulnow)
{
??printf(“%s?%g?/?%g?(%g?%%)\n“?progress_data?d?t?d*100.0/t);
??return?0;
}
?
int?main(int?argc?char?**argv)
{
??CURL?*curl;
??CURLcode?res;
??FILE?*outfile;
??char?*url?=?“http://10.10.1.4/d/c00000000000039/2014-10-22/10-28-35.ps“;
??char?*progress_data?=?“*?“;
?
??curl?=?curl_easy_init();
??if(curl)
??{
????outfile?=?fopen(“test.ps“?“wb“);
?
????curl_easy_setopt(curl?CURLOPT_URL?url);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????86846??2014-03-25?11:29??libCurl_downloadfile\curl\curl.h
?????文件??????22273??2014-03-26?07:49??libCurl_downloadfile\curl\curlbuild.h
?????文件???????7454??2014-01-05?23:07??libCurl_downloadfile\curl\curlbuild.h.cmake
?????文件???????7143??2013-09-09?00:11??libCurl_downloadfile\curl\curlbuild.h.in
?????文件???????8934??2013-09-09?00:11??libCurl_downloadfile\curl\curlrules.h
?????文件???????2741??2014-03-26?07:49??libCurl_downloadfile\curl\curlver.h
?????文件???????3472??2013-09-09?00:11??libCurl_downloadfile\curl\easy.h
?????文件???????2181??2013-09-09?00:11??libCurl_downloadfile\curl\Makefile.am
?????文件??????21726??2014-03-25?11:29??libCurl_downloadfile\curl\Makefile.in
?????文件???????2788??2013-09-09?00:11??libCurl_downloadfile\curl\mprintf.h
?????文件??????14813??2014-01-05?23:07??libCurl_downloadfile\curl\multi.h
?????文件???????1330??2013-09-09?00:11??libCurl_downloadfile\curl\stdcheaders.h
?????文件??????37398??2014-01-30?23:11??libCurl_downloadfile\curl\typecheck-gcc.h
?????文件???????1258??2014-10-22?14:16??libCurl_downloadfile\libCur1.cpp
?????文件???????4207??2014-10-22?14:08??libCurl_downloadfile\libCur1.dsp
?????文件????????537??2014-05-08?10:17??libCurl_downloadfile\libCur1.dsw
?????文件??????58368??2014-10-22?14:18??libCurl_downloadfile\libCur1.ncb
?????文件??????53760??2014-10-22?14:18??libCurl_downloadfile\libCur1.opt
?????文件???????1491??2014-10-22?14:17??libCurl_downloadfile\libCur1.plg
?????文件?????919366??2014-05-08?10:07??libCurl_downloadfile\libcurl.lib
?????文件????1950262??2014-05-08?10:08??libCurl_downloadfile\libcurld.lib
?????文件????????294??2014-05-08?10:17??libCurl_downloadfile\StdAfx.cpp
?????文件???????1087??2014-10-22?14:09??libCurl_downloadfile\StdAfx.h
?????目錄??????????0??2014-10-22?13:59??libCurl_downloadfile\curl
?????目錄??????????0??2014-10-22?14:19??libCurl_downloadfile
-----------?---------??----------?-----??----
??????????????3209729????????????????????25
- 上一篇:websocket-sharp 范例
- 下一篇:粒子群優化小波神經網絡車位預測
評論
共有 條評論