char filearray [5000] [513];
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;
}