Hi,
i have been trying to recursively search and list directories using ffind()but some how the nested ffind() doesn't work, i tried with static values also but no success
here is a part of the code, i am first trying to figure out how ffind works then implement recursive search
bool fileExist(char *drive, char *mask) { bool_t found = false; fsFileInfo fileInfo; char driveImage[5]; char concatenate[100]; char volumeToSearch[5]; fsStatus fFindStatus;
// Path, SearchString //Path = Volume + Directory Name + File Name
strcpy (driveImage, drive); sprintf(volumeToSearch,"%s*", driveImage);
fileInfo.fileID = 0;
while(ffind(volumeToSearch, &fileInfo) == fsOK) { // If item is a Directory, then search inside the directory if((fileInfo.attrib & FS_FAT_ATTR_DIRECTORY) == FS_FAT_ATTR_DIRECTORY) { sprintf(concatenate, "%s\\\\%s\\\\%s", driveImage, fileInfo.name, mask);
while(ffind(concatenate, &fileInfo) == fsOK) { found = true; } } }
if (fileInfo.fileID == 0) { SYSTEM_DEBUG_PRINT(SYS_ERROR_WARNING,"could not find %-32s", mask); } return found; }
thank you
auto/local variables will also present as dirty.