You must read the directory tree, starting with the specified. You also need to calculate the total number of files found (excluding . And .. ). The result of the function must be recorded in a separate file. Search filters are not required because all files of the same type. My version of the implementation:
static const char* filter = "."; QStringList create_config(QString dir_name) { QStringList ret_list; QDir dir(dir_name); QFileInfoList info_list = dir.entryInfoList(); if(info_list.size() > 2) { QList<QFileInfo>::iterator iter=info_list.begin(); QString path; for(iter=info_list.begin()+2;iter != info_list.end();iter++) { path = iter->absoluteFilePath(); if(iter->isDir()) { ret_list += create_config(path); } else { char ext[5]; strncpy(ext,path.toStdString().c_str() + (path.size() - 4),5); if(!strcmp(ext, filter))ret_list.append(path); } } } return ret_list; }
iter->completeSuffix() == filterand of course,QString filter = "...";- KoVadimcharandstrncpyin Qt code? Or everything connected with Qt you copied somewhere, but the part that you wrote yourself afterelse? - ixSci