[bcb] file handling

Pagina: 1
Acties:
  • 39 views sinds 30-01-2008

  • elgringo
  • Registratie: Januari 2001
  • Laatst online: 20-05 20:08
Ik wil een directory kunnen openen en vervolgens alles files die erin staan aflopen (en hier wat mee gaan doen).

Maar ik weet mijn god niet hoe je een directorie opent, je alle files hieruit kunt aflopen en eventueel nog wat in deze geopenden directorie opslaat. Google en Borland C++ builder in 24hrs. leveren weinig uitkomst. Voorbeelden zijn niet wat ik zoek.

Het gaat om BCB v6

if broken it is, fix it you should


  • curry684
  • Registratie: Juni 2000
  • Laatst online: 12-05 22:23

curry684

left part of the evil twins

Ik vind in mijn helpfiles binnen een paar luttele seconden de functies FindFirst, FindNext en FindClose. Met zelfs een mooi voorbeeld:
C++:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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);
  }
}

Extreem gevalletje 'lees de handleiding' of druk op F1 dus :z

Professionele website nodig?


Dit topic is gesloten.