Question : WIN32_FIND_DATA Size problem

Hello,

I use WIN32_FIND_DATA to get the size of files in a filelist. I have some probs with big files, means files that have GB values, like 4.4GB as a example.

WIN32_FIND_DATA FindData;
HANDLE hFind = ::FindFirstFile(pCtx->m_strLocation,&FindData);
if (hFind)
{
pCtx->m_nSize = FindData.nFileSizeLow;   //(Vector, m_nSize = int64)
::FindClose(hFind);
}

The rsult on small files are ok but with gigabyte allways a wrong size. Any idea why?

Ocrana

Answer : WIN32_FIND_DATA Size problem

FindData.nFileSizeLow is the correct size only if the file is less than 4,294,967,295 bytes.

The documentation is very clear and easy to read.  The fact that the variables is named
    FileSizeLow
is rather a clue.

    WIN32_FIND_DATA Structure
    http://msdn.microsoft.com/en-us/library/aa365740(VS.85).aspx

Wherein it says>> The size of the file is equal to (nFileSizeHigh * (MAXDWORD+1)) + nFileSizeLow
Random Solutions  
 
programming4us programming4us