DelphiBasics
GetDir
Procedure
Get the default directory (drive plus path) for a specified drive System unit
 procedure GetDir(Drive Byte; var Directory string);
Description
The GetDir procedure stores in the passed parameter Directory string the drive plus path name of the default directory on the specified Drive.
 
Drive values :
 
= Default drive
= A: drive
= B: drive
= C: drive
= D: drive
and so on. 
Related commands
ChDirChange the working drive plus path for a specified drive
CreateDirCreate a directory
GetCurrentDirGet the current directory (drive plus directory)
ForceDirectoriesCreate a new path of directories
MkDirMake a directory
RemoveDirRemove a directory
RmDirRemove a directory
SelectDirectoryDisplay a dialog to allow user selection of a directory
SetCurrentDirChange the current directory
 Download this web site as a Windows program.




 
Example code : Getting the directory for the C: drive
var
  DirName : string;

begin
  GetDir(3, DirName);  // Store C: directory in the DirName variable
  ShowMessage(DirName);
end;
Show full unit code
  The following output is representative, and will necessarily vary
  from PC to PC:
  
  C:\Program Files\Borland\Delphi7\Projects
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page