Please take a look at this and tell me why Memo1->Lines->Add(c_Dir); resultst in 7??
It simply refuses to recursive it self as i want it too... perhaps I've overlooked something?
My codes look like something a kid wrote
I have absolutely no idea what I am talking about
Somehow I still manage to make it work
It simply refuses to recursive it self as i want it too... perhaps I've overlooked something?
Code:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
char *c_Dir = Edit1->Text.c_str();
char *c_Mask = "*.*";
Memo1->Lines->Clear();
ScanDir(Form1,c_Dir,c_Mask);
}
void __fastcall TForm1::ScanDir(TObject *Sender, char *c_Dir, char *c_Mask)
{
struct ffblk ffblk;
int done;
int deep;
char sTmp[512], sTmp2[512];
strcpy(sTmp,c_Dir);
strcat(sTmp,c_Mask);
done = findfirst( sTmp, &ffblk, FA_DIREC + FA_SYSTEM + FA_HIDDEN + FA_RDONLY + FA_ARCH );
while( !done )
{
if( strcmp( ".", ffblk.ff_name ) != 0
&& strcmp( "..", ffblk.ff_name ) != 0 )
{
if( (ffblk.ff_attrib & FA_DIREC) == FA_DIREC )
{
strcpy(sTmp2,c_Dir);
strcat(sTmp2,ffblk.ff_name);
strcat(sTmp2,"\\");
Memo1->Lines->Add(c_Dir);
ScanDir(Form1, sTmp2 , c_Mask);
}
}
done = findnext(&ffblk);
}
}
My codes look like something a kid wrote
I have absolutely no idea what I am talking about
Somehow I still manage to make it work