xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

CurDrive()

Determines or changes the current disk drive

Syntax

CurDrive( [<cNewDrive>] ) --> cOldDrive

Arguments

<cNewDrive>
A single character, optionally followed by a colon, specifies the disk drive to select as current. If omitted, the disk drive is not changed.

Return

The function returns the a single letter specifying the disk drive that is current before the function is called (the previous disk drive).

Description

CurDrive() queries the current disk drive and optionally changes to a new one. The new disk drive to change to is specified with <cNewDrive>.

Use function IsDisk() to check for the existence of a disk drive.

Info

See also:CurDir(), DiskChange(), DiskName(), DiskSpace(), Getenv(), IsDisk(), SET DEFAULT, SET PATH
Category: Disks and Drives , File functions
Source:rtl\philesx.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example queries and changes the current disk drive
// and displays the current directory for each drive.

   PROCEDURE Main

      ? CurDrive( "C:" )               // result: D
      ? CurDrive()                     // result: C

      ? CurDir()                       // result: temp
      ? CurDrive( "D" )                // result: C

      ? CurDir()                       // result: xhb\source\samples
      ? CurDrive()                     // result: D

      ? CurDir()                       // result: xhb\source\samples

   RETURN

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