最近设法在测试程序中使用libcurl来下载文件.代码是这样的:
CURL * curl;
FILE * fout;
CURLcode result;
char * url = "http://blablabla.com/blablabla.txt";
char filename[FILENAME_MAX] = "blablabla.txt";
curl = curl_easy_init();
if (curl)
{
fout = fopen(filename,"wb");
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fout);
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
fclose(fout);
}
Run Code Online (Sandbox Code Playgroud)
以及指令的那些东西:
#define CURL_STATICLIB
#include <curl/curl.h>
Run Code Online (Sandbox Code Playgroud)
我的问题是如何使我不需要在exec中将所有dll复制到同一目录中以使其工作:
libcurl.dll
libeay32.dll
libidn-11.dll
librtmp.dll
libssh2.dll
libssl32.dll
zlib1.dll
Run Code Online (Sandbox Code Playgroud)
无法在库的主页(http://curl.haxx.se)中找到有关该信息的信息:|