file size wraps at 2GiB
WinSCP 4.1.9 build 416
Windows XP Pro SP3
SFTP+SCP
GUI, Norton Commander
there is a problem with calculation of filesize.
calculation of filesize seems to wrap around and start at 0 again at the 2GiB point, which tells me a 32-bit number type is being used.
Perhaps an int or long or DWORD (32-bit number) is being used for the data type, because my 2.6GB .ISO file showd up as a 500MB.
download in the progress bar, numbers, etc.
you should be using an __int64 or LARGE_INTEGER instead for your calculations.
LARGE_INTEGER is a structure rather than a simple data type like __int64.
the part you are interested in with LARGE_INTEGER is .QuadPart which is 64-bit.
file sizes should be calculated using the windows structure LARGE_INTEGER and the Win32 call GetFileSize().
for some sample code using LARGE_INTEGER, try this:
Windows XP Pro SP3
SFTP+SCP
GUI, Norton Commander
there is a problem with calculation of filesize.
calculation of filesize seems to wrap around and start at 0 again at the 2GiB point, which tells me a 32-bit number type is being used.
Perhaps an int or long or DWORD (32-bit number) is being used for the data type, because my 2.6GB .ISO file showd up as a 500MB.
download in the progress bar, numbers, etc.
you should be using an __int64 or LARGE_INTEGER instead for your calculations.
LARGE_INTEGER is a structure rather than a simple data type like __int64.
the part you are interested in with LARGE_INTEGER is .QuadPart which is 64-bit.
file sizes should be calculated using the windows structure LARGE_INTEGER and the Win32 call GetFileSize().
for some sample code using LARGE_INTEGER, try this:
#include <windows.h> LARGE_INTEGER li; __int64 filesize64=0; li.QuadPart=0; HANDLE h=CreateFile( lpFileName, // pointer to name of the file GENERIC_READ, // access (read-write) mode FILE_SHARE_READ, // share mode NULL, // pointer to security attributes OPEN_EXISTING, // how to create FILE_ATTRIBUTE_NORMAL, // file attributes INVALID_HANDLE_VALUE // handle to file with attributes to copy ); if (INVALID_HANDLE_VALUE != h) { DWORD d0, d1; d0=GetFileSize( h, // handle of file to get size of &d1 // pointer to high-order word for file size ); if (0xFFFFFFFF==d0) { DWORD er=GetLastError(); if (NO_ERROR==er) { li.LowPart=d0; li.HighPart=(LONG)d1; filesize64=li.QuadPart; } else { //ERROR: problem getting filesize. } } CloseHandle(h); } else { //ERROR: could not open file. } //at this point, filesize is in both filesize64 and li.QuadPart //for sprintf, use "%I64d"