| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Returns the serial number of a disk drive.
VolSerial( [<cDrive>] ) --> nVolumeSerial
The function returns the serial number of a disk as a numeric value or -1 in case of an error.
| See also: | CurDrive(), GetVolInfo(), Os(), Version() |
| Category: | CT:DiskUtil , Disks and Drives |
| Source: | ct\disk.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example lists the volume serial numbers of all drives and displays
// them in Hex format.
PROCEDURE Main
LOCAL cDrive, i, nSerial, cSerial
FOR i:=1 TO 26
cDrive := Chr(64+i) + ":\"
nSerial := VolSerial( cDrive )
IF nSerial <> -1
cSerial := NumToHex( nSerial )
? cDrive, Stuff( cSerial, 5, 0, ":" )
ENDIF
NEXT
RETURN
http://www.xHarbour.com