Previous Topic: GetDiskFree, GetDiskFreeB, GetDiskFreeKB, and GetDiskFreeMB - Return Free Disk SpaceNext Topic: GetDiskUsage, GetDiskUsageB, GetDiskUsageKB, and GetDiskUsageMB - Return the Amount of Disk Usage


GetDiskSize, GetDiskSizeB, GetDiskSizeKB, and GetDiskSizeMB - Return the Disk Size

Valid on Symbian OS, Windows, and Windows CE

The GetDiskSize function returns the disk size in KB, the GetDiskSizeB function returns the disk size in bytes, the GetDiskSizeKB function returns the disk size in KB, and the GetDiskSizeMB function returns the disk size in MB.

Function format:

GetDiskSize(drivenumb1 as Integer) as Integer
GetDiskSizeB(drivenumb1 as Integer) as Integer
GetDiskSizeKB(drivenumb1 as Integer) as Integer
GetDiskSizeMB(drivenumb1 as Integer) as Integer
drivenumb1

Indicates the drive number. Use 0 for the default, 1 for A, 2 for B, and so on.

The functions return the size in a 32-bit integer format. Large disks may exceed the capacity of such a representation, resulting in wrong sizes or negative values due to truncation.

Each function returns an integer, which is the disk size, as follows:

GetDiskSize

Disk size value in KB.

GetDiskSizeB

Disk size space value in bytes.

GetDiskSizeKB

Disk size value in KB.

GetDiskSizeMB

Disk size value in MB.

Note: Use the GetFileStoreSize function, which is portable, instead of the GetDiskSize functions.

Example:

Dim Size,Used,Free as integer
Dim out as string

Size=GetDiskSize(3)
if (Size<>-1) then
	 out="Total size: "+chr(9)+str(Size)+" bytes"+ chr(10)
	 Used=GetDiskUsage(3)
	 out=out+"Bytes used: "+chr(9)+str(Used)+" bytes"+ chr(10)
	 Free=GetDiskFre