RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.GetDir Function

Returns the current directory.

Pascal
procedure GetDir(D: Byte; var S: string);
C++
GetDir(Byte D, AnsiString S);

System

Note: On Windows, GetDir sets the S parameter to the current directory on the drive specified by the D parameter. D can be set to any of the following values:

Value 
Drive 
0  
Default  
1  
A  
2  
B  
3  
C  

Note: GetDir performs no error checking. For example, if the invalid value 5 (J) were specified, S would return J:\ as if it were the root directory of the invalid drive.
Note: On Linux, GetDir returns the current working directory using the S parameter. The first parameter is ignored.
 

Delphi Examples: 

 

{
This example reports the current directory and drive.  Set
Help on GetDir for reporting information on other drives.
}
procedure TForm1.Button1Click(Sender: TObject);
var
  s : string;
begin
  GetDir(0,s); { 0 = Current drive }
  MessageDlg('Current drive and directory: ' + s, mtInformation, [mbOk] , 0);
end;

 

ChDir 

MkDir 

RmDir 

DirectoryExists 

CreateDir 

GetCurrentDir

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!