RAD Studio VCL Reference
|
Returns the full path name for a relative file name.
function ExpandFileName(const FileName: string): string; overload;
AnsiString ExpandFileName(const AnsiString FileName);
ExpandFileName converts the relative file name into a fully qualified path name. ExpandFileName does not verify that the resulting fully qualified path name refers to an existing file, or even that the resulting path exists.
C++ Examples:
/* The following example uses a listbox, an edit control, and a button on a form. When the button is clicked, the filename specified in the edit control is expanded to a fully qualified filename and added to the list box. */ void __fastcall TForm1::Button1Click(TObject *Sender) { ListBox1->Items->Add(ExpandFileName(Edit1->Text)); } void __fastcall TForm1::FormCreate(TObject *Sender) { Label2->Caption = ExtractFilePath(Application->ExeName); }
Delphi Examples:
{ The following example uses a listbox, an edit control, and a button on a form. When the button is clicked, the filename specified in the edit control is expanded to a fully qualified filename and added to the list box. } procedure TForm1.Button1Click(Sender: TObject); begin ListBox1.Items.Add(SysUtils.ExpandFileName(Edit1.Text)); end; procedure TForm1.FormCreate(Sender: TObject); begin Label2.Caption := ExtractFilePath(Application.ExeName); end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|