xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

CurDir()

Returns the current directory of a drive

Syntax

CurDir( [<cDrive>] ) --> cDirPath

Arguments

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

Return

The function returns the current directory of the specified disk drive as a character string without leading and trailing directory separator.

Description

The function is used to determine the current directory of a disk drive. If the drive <cDrive> does not exist or the root directory is current, CurDir() returns a null string ("").

Note that CurDir() reports the current directory of the operating system for a specified drive. It does not report directories set with SET DEFAULT or SET PATH.

Use function DirChange() to change the current directory.

Info

See also:CurDirX(), CurDrive(), DirChange(), Directory(), DirRemove(), File(), Getenv(), MakeDir()
Category: Directory functions , File functions
Source:rtl\philes.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example lists the current directories for drive C: to I:

   PROCEDURE Main
      LOCAL nDrive := Asc( "C" )
      LOCAL i

      FOR i:=1 TO 7
         ? Chr(nDrive) + ":\"+ CurDir( Chr(nDrive) )
         nDrive ++
      NEXT
   RETURN

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