Änderungsdatum einer Datei auslesen



  • Hallo,
    ich beschäftige mich momentan mit FindFirst u. FindNext.
    Da habe ich dann das Beispiel aus Borland ausgegraben. Damit kann ich die Dateien, die sich in einem Ordner befinden, auslesen.
    Mein frage wäre, wie ich das ganze erweitern kann damit ich auch das
    Änderungsdatum im StringGrid aufgelistet bekomme.

    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
      TSearchRec sr;
      int iAttributes = 0;
      StringGrid1->RowCount = 1;
      iAttributes |= faReadOnly * CheckBox1->Checked;
      iAttributes |= faHidden * CheckBox2->Checked;
      iAttributes |= faSysFile * CheckBox3->Checked;
      iAttributes |= faVolumeID * CheckBox4->Checked;
      iAttributes |= faDirectory * CheckBox5->Checked;
      iAttributes |= faArchive * CheckBox6->Checked;
      iAttributes |= faAnyFile * CheckBox7->Checked;
      StringGrid1->RowCount = 0;
      if (FindFirst(Edit1->Text, iAttributes, sr) == 0)
    
      {
        do
        {
          if ((sr.Attr & iAttributes) == sr.Attr)
          {
            StringGrid1->RowCount = StringGrid1->RowCount + 1;
            StringGrid1->Cells[1][StringGrid1->RowCount-1] = sr.Name;
            StringGrid1->Cells[2][StringGrid1->RowCount-1] = IntToStr(sr.Size);
          }
        } while (FindNext(sr) == 0);
        FindClose(sr);
      }
    }
    


  • Hallo,

    Schau doch bitte mal in die Hilfe zu TSearchRec (speziell FindData und Time). Da steht unter anderen auch das drin.


Anmelden zum Antworten