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.PixGetFr eeDiskSpac e(oPathInf o.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
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.PixGetFr
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);
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It was a UNC problem. Thanks for the hint.
other suggestion is to call GetLastError http://msdn.microsoft.com/en-us/library/ms679360(VS.85).aspx