GetDiskFreeSpaceEx reports wrong number of free bytes

Posted by rboorgapally on Stack Overflow See other posts from Stack Overflow or by rboorgapally
Published on 2009-03-09T17:05:06Z Indexed on 2010/04/21 4:03 UTC
Read the original article Hit count: 306

Filed under:
|
|
|
__int64 i64FreeBytes
unsigned __int64 lpFreeBytesAvailableToCaller,
                 lpTotalNumberOfBytes,
                 lpTotalNumberOfFreeBytes; // variables used to obtain 
                                           // the free space on the  drive

GetDiskFreeSpaceEx (Manager.capDir,
(PULARGE_INTEGER)&lpFreeBytesAvailableToCaller,
(PULARGE_INTEGER)&lpTotalNumberOfBytes,
(PULARGE_INTEGER)&lpTotalNumberOfFreeBytes);

i64FreeBytes = lpTotalNumberOfFreeBytes;
_tprintf(_T ("Number of bytes free on the drive:%I64u \n"),
     lpTotalNumberOfFreeBytes);

I am working on a data management routine which is a Windows CE command line application. The above code shows how I get the number of free bytes on a particular drive which contains the folder Manager.capdir (it is the variable containing the full path name of the directory).

My question is, the number of free bytes reported by the above code (the _tprintf statement) doesn't match with the number of free bytes of the drive (which i check by doing a right click on the drive).

I wish to know if the reason for this difference?

© Stack Overflow or respective owner

Related posts about windows-ce

Related posts about winapi