FileSearch (C++)
Description
The following example uses an edit control and a button on a form. When you click the button, the current directory is searched for the file name specified in the edit control. A message box indicates whether the file was found.
Code
void __fastcall TForm1::Button1Click(TObject *Sender)
{
String asFileName = FileSearch(Edit1->Text, GetCurrentDir());
if (asFileName.IsEmpty())
ShowMessage(String("Couldn't find ") + Edit1->Text + ".");
else
ShowMessage(String("Found ") + asFileName + ".");
}
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Label2->Caption = GetCurrentDir();
}
Uses
- System.SysUtils.FileSearch ( fr | de | ja )
- Vcl.Dialogs.ShowMessage ( fr | de | ja )