| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Returns the current directory of a drive including directory separators.
CurDir( [<cDrive>] ) --> cDirPath
The function returns the current directory of the specified disk drive as a character string including leading and trailing directory separator.
CurDirX() works exacly like CurDir() but adds a leading and trailing directory separator to the returned directory string
| See also: | CurDir(), CurDrive(), DirChange(), Directory(), DirRemove(), File(), Getenv(), MakeDir() |
| Category: | Directory functions , File functions , xHarbour extensions |
| Source: | rtl\philes.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example compares CurDir() and CurDirX()
PROCEDURE Main
LOCAL nDrive := Asc( "C" )
LOCAL i
// directory with CurDir()
FOR i:=1 TO 7
? Chr( nDrive ) + ":\"+ CurDir( Chr(nDrive) ) + "\"
nDrive ++
NEXT
nDrive := Asc( "C" )
// directory with CurDirX()
FOR i:=1 TO 7
? Chr( nDrive ) + ":"+ CurDirX( Chr(nDrive) )
nDrive ++
NEXT
RETURN
http://www.xHarbour.com