| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Returns the current directory of a drive
CurDir( [<cDrive>] ) --> cDirPath
The function returns the current directory of the specified disk drive as a character string without leading and trailing directory separator.
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.
| 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 |
// 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
http://www.xHarbour.com