Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
char directoryarray [5000] [256];
char filearray [5000] [100];
int RecurseDir (char *dir, char *wild, int x)
{
// Loads the directoryarray
struct ffblk ffblk;
int done;
char buff [512];
strcpy( buff, dir );
strcat( buff, wild );
done = findfirst(buff, &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)
{
// process directory
strcpy(buff, dir);
strcat(buff, ffblk.ff_name);
strcpy (directoryarray [x], buff);
strcat(buff, "\\");
x++;
x = RecurseDir(buff, wild, x);
}
else
{
//
}
}
done = findnext(&ffblk);
}
return x;
}
int ScanDir (char *dir)
{
// This function scans a directory for all files.
// Loads the filearray
struct ffblk ffblk;
int done;
int x = 0;
char *buff = new char [512];
strcpy(buff, dir);
strcat(buff, "*.*");
done = findfirst(buff, &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);
else
{
strcpy (filearray [x], ffblk.ff_name);
x++;
}
}
done = findnext(&ffblk);
}
delete buff;
return x;
}
[\code]
I use a large array because in the app I use this code in
the entire drive directory list is sometimes loaded. you
coud probably get by with 1/4 size or less depending upon
the usage.
TC