Click or drag to resize

DiskSpace Function (Long)

X#
Return the capacity of the specified disk.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 FUNCTION DiskSpace(
	nDrive AS LONG
) AS INT64
Request Example View Source

Parameters

nDrive
Type: Long
The number of the disk drive to query, where 1 is drive A, 2 is B, 3 is C, and so on. The drive can also be identified as a string, for example "C:", "A:". If you do not specify a drive, the Windows default is used.

Return Value

Type: Int64
The capacity of the specified disk drive in bytes.
Remarks
DiskSpace() determines the capacity of the specified disk drive in bytes. This function is only accurate for disk drives up to 2 gigabytes in size.
For larger drives, please refer to the GetDiskFreeSpaceEx() Windows API function.
Examples
This example displays the capacity of the C drive in a TextBox:
X#
1TextBox{, "C Drive Capacity", AsString( DiskSpace(3) ) }:Show()
2TextBox{, "C Drive Capacity", AsString( DiskSpace("C:") ) }:Show()
See Also