cURL / Mailing Lists / curl-library / Single Mail

curl-library

CURLOPT_INFILESIZE_LARGE & CURLOPT_INFILESIZE

From: <delphine.menjikoff_at_orsyp.com>
Date: Thu, 31 Mar 2005 14:51:05 +0200

Hellooooo,

 

I use libcurl in order to generate a little sample (based on ftpupload.c
curl sample).

 

I try to upload a file (local file size = 1154730 bytes) on my Linux
serveur (from this same Linux machine).

I get this error:

 

Uploaded unaligned file size (1154730 out of 4617634290435464874 bytes)

* Closing connection #0

>>> command return error code Curl : 18

 

In my source code, I used in particularly this option (pass size in
curl_off_t size):

 

/* file_info is a stat structure and initialize by stat() function */

curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE,
(curl_off_t)file_info.st_size);

 

I have 4617634290435464874 value (????), because SIZEOF_CURL_OFF_T > 4
(SIZE_CURL_OFF_T = 8 from config.h) so

FORMAT_OFF_T = "lld" (test from setup.h)

That's why %lld of 1154730 = 4617634290435464874 (bytes)

(So, with FORMAT_OFF_T = "ld", I have 1154730 value instead of
4617634290435464874 )

 

My question: this is a problem from the configure which set
SIZEOF_CURL_OFF_T to 8 value (instead 4 value maybe) or this is a
problem of my Linux OS configuration (I know that my Linux OS is pretty
old).

 

But when I use this option (pass size in long format):

 

long long_size = file_info.st_size;

curl_easy_setopt(curl, CURLOPT_INFILESIZE, long_size);

 

This is working fine.

 

I can satisfy myself with CURLOPT_INFILESIZE option. But when I'll have
big file size, is it better to use CURLOPT_INFILESIZE_LARGE?

 

Any explanations will be appreciated.

Thanks for your help.

 

Delphine.
Received on 2005-03-31