Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DISKSPACE() Function for large drives under FP 2.5
Message
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00242500
Message ID:
00242512
Views:
21
>Hello,
>
>We have a legacy application running under FoxPro 2.5 with the clients running Windows 95 or Windows NT 4.0. In some situations, they are working with compressed (ZIP) databases that are often copied to the local PC drive for extra speed and write capability. Our application makes use of the DISKSPACE() function to determine if there will be enough free space on a given drive before attempting to load the data.
>
>Now, the problem (as I've known for a while) is that this function will not reliably return the correct free space. The maximum it returns is 1gb of free space and compressed data fitting on 650MB CD-ROM will unexpand to much more than this in many cases.
>
>Has anyone written an FLL or alternative FoxPro function that will return at minimum 2gb free (if there is at least that much free). One solution I have so far is to call the WINAPI32 function GetDiskFreeSpace() from an FLL. I am able to call it from VFP 5.0 using the DECLARE statement but this feature doesn't seem to exist in 2.5. :-/
>

Hi Greg. Christof Lange posted some code a few months back. As follows:

----------------------------------------------------------------
Yes. DOS was only able to determine 2 GB of free disk space. If you enter DIR on such a drive you commonly got 1,999,999,999 bytes free. FoxPro can handle up to 4 GB, but will return more than 2 GB as a negative value. For more than 4 GG, it starts again, that means 5 GB are reported as 1 GB. The following routine works up to 4 GB of free disk space:
*==================================================
* Returns the available diskspace
*==================================================
Parameter tcDrive

*-----------------------------------------------
* evaluate parameter
*-----------------------------------------------
Private lcDrive
If Parameter() == 1
lcDrive = tcDrive
Else
lcDrive = Sys(5)
Endif

*-----------------------------------------------
* Get free disk space
*-----------------------------------------------
Private lcDefault, lnSize
lcDefault = Sys(5) + Sys(2003)
Set Default to &lcDrive
lnSize = Diskspace()
If lnSize < 0
lnSize = lnSize + 2^32
Endif
Set Default to &lcDefault

Return lnSize
Previous
Reply
Map
View

Click here to load this message in the networking platform