RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.MkDir Function

Creates a new subdirectory.

Pascal
procedure MkDir(const S: string); overload;
procedure MkDir(P: PChar); overload;
C++
MkDir(const AnsiString S);
MkDir(const char * P);

System

MkDir creates a new subdirectory with the path specified by string S or P. The last item in the path cannot be an existing file name.

Note: In Delphi, {$I+} handles runtime errors using exceptions. When using {$I-}, use IOResult to check for an I/O error.
 

Delphi Examples: 

 

{
The following sample code sets the directory of
DirectoryListBox1 to C:\WINDOWS when the form is created.
When Button1 is pressed, a subdirectory called
mytemp is added to C:\WINDOWS, but note that it is not
updated in DirectoryListBox1 until Button2 is pressed
and Update is called.
Note: A EInOutError will occur if you add a directory that
already exists.  Also, you must add the new directory to
your current path to see the magic happen.
}

procedure TForm1.Button1Click(Sender: TObject);
begin
  MkDir(Edit1.Text);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  DirectoryListBox1.Update;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  DirectoryListBox1.Directory := 'c:\WINDOWS';
end;

 

ChDir 

GetDir 

RmDir 

ForceDirectories

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