xHarbour Reference Documentation > Function Reference |
Returns the free storage space for a disk drive by drive letter.
HB_DiskSpace( <cDrive>, [<nType>] ) --> nBytes
Storage space types for HB_DiskSpace()
Constant | Value | Description |
---|---|---|
HB_DISK_AVAIL *) | 0 | Free disk space avialable to the application |
HB_DISK_FREE | 1 | Total free disk space |
HB_DISK_USED | 2 | Used disk space |
HB_DISK_TOTAL | 3 | Total disk space |
*) default |
The function returns a numeric value indicating the storage space of a disk drive. If no parameters are passed, DiskSpace() returns the free disk space on the current drive that is available to the application.
HB_DiskSpace() determines free and used bytes on a disk drive accepting a drive letter. Some operating systems distinguish between total free bytes on disk and free bytes that are avalaible to the current user, or application. If the current operating system makes no such distinction, HB_DISK_AVAIL and HB_DISK_FREE yield the same results.
Note: if information is requested on a disk that is not available, a runtime error 2018 is generated.
See also: | Directory(), DiskName(), DiskSpace(), File(), FOpen(), FSeek(), IsDisk() |
Category: | Disks and Drives , xHarbour extensions |
Source: | rtl\disksphb.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example lists two disk storage types for all drives taking // advantage of the runtime error created for unaccessible drives. #include "Fileio.ch" PROCEDURE Main LOCAL cDrive, i, bError := ErrorBlock( {|e| Break(e) } ) FOR i:=1 TO 26 cDrive := Chr(64+i) ? cDrive+":" BEGIN SEQUENCE ?? HB_DiskSpace( cDrive, HB_DISK_FREE ), ; HB_DiskSpace( cDrive, HB_DISK_TOTAL) RECOVER ?? " not ready or not existent" END SEQUENCE NEXT ErrorBlock( bError ) RETURN
http://www.xHarbour.com