Use curl_off_t and CURL_FORMAT_CURL_OFF_T for file size.
This commit is contained in:
Родитель
89f6567fda
Коммит
420bfbcf40
|
@ -55,6 +55,7 @@ int main(int argc, char **argv)
|
||||||
CURLcode res;
|
CURLcode res;
|
||||||
FILE *hd_src;
|
FILE *hd_src;
|
||||||
struct stat file_info;
|
struct stat file_info;
|
||||||
|
curl_off_t fsize;
|
||||||
|
|
||||||
struct curl_slist *headerlist=NULL;
|
struct curl_slist *headerlist=NULL;
|
||||||
static const char buf_1 [] = "RNFR " UPLOAD_FILE_AS;
|
static const char buf_1 [] = "RNFR " UPLOAD_FILE_AS;
|
||||||
|
@ -65,7 +66,9 @@ int main(int argc, char **argv)
|
||||||
printf("Couldnt open '%s': %s\n", LOCAL_FILE, strerror(errno));
|
printf("Couldnt open '%s': %s\n", LOCAL_FILE, strerror(errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
printf("Local file size: %ld bytes.\n", (long)file_info.st_size);
|
fsize = (curl_off_t)file_info.st_size;
|
||||||
|
|
||||||
|
printf("Local file size: %" CURL_FORMAT_CURL_OFF_T " bytes.\n", fsize);
|
||||||
|
|
||||||
/* get a FILE * of the same file */
|
/* get a FILE * of the same file */
|
||||||
hd_src = fopen(LOCAL_FILE, "rb");
|
hd_src = fopen(LOCAL_FILE, "rb");
|
||||||
|
@ -100,7 +103,7 @@ int main(int argc, char **argv)
|
||||||
curl_off_t. If you use CURLOPT_INFILESIZE (without _LARGE) you must
|
curl_off_t. If you use CURLOPT_INFILESIZE (without _LARGE) you must
|
||||||
make sure that to pass in a type 'long' argument. */
|
make sure that to pass in a type 'long' argument. */
|
||||||
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE,
|
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE,
|
||||||
(curl_off_t)file_info.st_size);
|
(curl_off_t)fsize);
|
||||||
|
|
||||||
/* Now run off and do what you've been told! */
|
/* Now run off and do what you've been told! */
|
||||||
res = curl_easy_perform(curl);
|
res = curl_easy_perform(curl);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче