xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

VolSerial()

Returns the serial number of a disk drive.

Syntax

VolSerial( [<cDrive>] ) --> nVolumeSerial

Arguments

<cDrive>
A single character, followed by a colon and backslash, specifies the disk drive to query. If omitted, the current drive is queried.

Return

The function returns the serial number of a disk as a numeric value or -1 in case of an error.

Info

See also:CurDrive(), GetVolInfo(), Os(), Version()
Category: CT:DiskUtil , Disks and Drives
Source:ct\disk.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe