0
我有一個簡單的例子:最後修改場和下載文件
include <curl/curl.h>
char tmp[] = "/var/tmp/tmp";
char fullpath[] = "/var/tmp/test";
FILE* fp;
CURL* curl;
char bufferError[CURL_ERROR_SIZE];
CURLcode result;
int main() {
curl = curl_easy_init();
fp = fopen(tmp, "wb");
char url[] = "http://10.100.1.5/promorolik/Skoro_Shrek_4_obrez.mp4";
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, bufferError);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_HEADER, 0);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
fclose(fp);
rename(tmp, fullpath);
return 0;
}
如何下載文件「測試」設置從文件屬性中的服務器? (從最後修改字段創建文件的時間)?