FileOperations (C++)
Description
This example demonstrates the copying, moving and deleting of files provided by methods of TFile class.
Code
void __fastcall TForm1::operations(TObject *Sender)
{
try
{
/* Copy file from source file path to destination file path */
if (Sender == btnCopy)
TFile::Copy(edSourcePath->Text, edDestinationPath->Text);
/* Move file from source file path to destination file path */
if (Sender == btnMove)
TFile::Move(edSourcePath->Text, edDestinationPath->Text);
/* Delete file from source file path */
if (Sender == btnDelete)
TFile::Delete(edSourcePath->Text);
}
catch(...)
{
MessageDlg("Incorrect path", mtError, TMsgDlgButtons() << mbOK, 0);
return;
}
}
//---------------------------------------------------------------------------
Uses
- System.IOUtils.TFile.Copy ( fr | de | ja )
- System.IOUtils.TFile.Move ( fr | de | ja )
- System.IOUtils.TFile.Delete ( fr | de | ja )