0
我嘗試下面的例子後捲曲複製文件:捲曲下載的文件總是空
CURL *curl;
FILE *fp;
CURLcode res;
char *url = "http://localhost/aaa.txt";
char outfilename[FILENAME_MAX] = "D:\\bbb.txt";
curl = curl_easy_init();
if(curl)
{
fp = fopen(outfilename,"wb");
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
fclose(fp);
}
它創建了一個名爲bbb.txt
文件,但該文件是空的。願你能幫助我嗎?我的錯誤是什麼?