FILE *f;
curl_off_t local_file_len = 0 ;
long filesize =0 ;
struct stat file_info;
int use_resume = 0;
if(stat(localpath, &file_info) == 0){
local_file_len = file_info.st_size;
use_resume = 1;
}
f = fopen(localpath, "ab+");
if (f == NULL) {
perror(NULL);
return 0;
}
curl_easy_setopt(curlhandle, CURLOPT_URL, remotepath);
curl_easy_setopt(curlhandle, CURLOPT_CONNECTTIMEOUT, timeout);
curl_easy_setopt(curlhandle, CURLOPT_HEADERFUNCTION, getcontentlengthfunc);
//将head写到返回体中
// curl_easy_setopt(curlhandle, CURLOPT_HEADER, 1);
curl_easy_setopt(curlhandle, CURLOPT_HEADERDATA, &filesize);
curl_easy_setopt(curlhandle, CURLOPT_RESUME_FROM_LARGE, use_resume?local_file_len:0);
curl_easy_setopt(curlhandle, CURLOPT_WRITEFUNCTION, wirtefunc);
curl_easy_setopt(curlhandle, CURLOPT_WRITEDATA, f);
curl_easy_setopt(curlhandle, CURLOPT_NOPROGRESS, 0L);
curl_easy_setopt(curlhandle, CURLOPT_VERBOSE, 1L);
CURLcode r = CURLE_GOT_NOTHING;
r = curl_easy_perform(curlhandle);
fclose(f);
return r;
运行后返回错误码:56 求解答啊。困扰好久~~~