Finding The Default Drive Size

Click to select the code.  Use Control-C to copy it to your clipboard. Help


The size of the default drive can be found with the DiskSize function.  This is part of SysUtils, which should be declared in your uses clause.  The value returned is in bytes.

You can also get the size of other drives.  DiskSize(0) returns the default drive size; but [usually] DiskFree(1) would return the size of drive A:. DiskSize(2) for B:, DiskSize(3) for C:, and so on.  Caution with this, though, as not all systems are configured the same way in hardware.  DiskSize will return -1 if a drive is unavailable (for example, no diskette in the A: drive).


Copyright 2001 - 2012 by and OECCorp.
The 2012 Evolution™ is an OEC InterNET Group site.SupportNotices