| Цитата | void __fastcall TForm1::Button1Click(TObject *Sender)
{ FILE *stream; char FirstLine[512]; OpenDialog1->Options.Clear(); OpenDialog1->Options << ofAllowMultiSelect << ofFileMustExist; OpenDialog1->Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*"; OpenDialog1->FilterIndex = 2; // start the dialog showing all files if (OpenDialog1->Execute()) { for (int I = 0; I < OpenDialog1->Files->Count; I ++) { stream = fopen(OpenDialog1->Files->Strings[I].c_str(), "r");
if (stream) { // read the first line from the file fgets(FirstLine, sizeof(FirstLine), stream); Memo1->Lines->Append(FirstLine); fclose(stream); } } } } | |