Link to home
Start Free TrialLog in
Avatar of Ocrana
Ocrana

asked on

GetDiskFreeSpaceEx And Terrabyte

Hi,

I have a function where I check the available diskspace before start to save. It works well but if I query our 9 Terrabyte Networkdrive I got allways the message "Not enough space". Here I use:
      float theSize = theApp.appHelpers.PixGetFreeDiskSpace(oPathInfo.GetDrive());
      if(theSize<4482){    //Space in MB for a DVD Image
         //Error
         MessageBox(L"Not Enough Space");
         return FALSE;
      }
With the function in the code area. What do I worng?

Ocrana


double CPixbyteHelpers::PixGetFreeDiskSpace(CString tDrive)
{
	ULARGE_INTEGER uliFreeBytesAvailable,uliTotalNumberOfBytes,uliTotalNumberOfFreeBytes;
	uliFreeBytesAvailable.QuadPart = 0L;
	uliTotalNumberOfBytes.QuadPart = 0L;
	uliTotalNumberOfFreeBytes.QuadPart = 0L;

	if (!GetDiskFreeSpaceEx(tDrive,&uliFreeBytesAvailable,&uliTotalNumberOfBytes,&uliTotalNumberOfFreeBytes))
	{
		return -1; // could not get info.
	}

	//return megabytes free.
	return (uliTotalNumberOfFreeBytes.QuadPart/1024.0/1024.0);
}

Open in new window

Avatar of jhshukla
jhshukla
Flag of United States of America image

well, you could start by figuring out what uliTotalNumberOfFreeBytes.QuadPart is.

other suggestion is to call GetLastError http://msdn.microsoft.com/en-us/library/ms679360(VS.85).aspx
ASKER CERTIFIED SOLUTION
Avatar of DonConsolio
DonConsolio
Flag of Austria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ocrana
Ocrana

ASKER

It was a UNC problem. Thanks for the hint.