niedziela, 5 listopada 2023

std::tuple C++ Builder


void __fastcall TForm1::info_File(UnicodeString name, int size, UnicodeString date_Modification)
{
Edit1->Text=name;
Edit2->Text=IntToStr(size);
Edit3->Text=date_Modification;
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
using INFO=tuple<UnicodeString,int,UnicodeString>;
TSearchRec info_Sys;
AnsiString date,name_File;
int bytes;
 name_File=Application->ExeName;
 if(FindFirst(name_File,faAnyFile,info_Sys)!=0)
 {
ShowMessage("I can't open file");
Close();
 }
 bytes=info_Sys.Size;
 date=DateTimeToStr(FileDateToDateTime(info_Sys.Time));
 INFO application_exe={name_File,bytes,date};
 const auto &[name,size,date_Modification]=application_exe;
 info_File(name,size,date_Modification);
}