C++便利文件夹下文件

void DataProvider::searchFile(){
	struct dirent *ptr;
	DIR *dir;
	const  char *path=filePath.c_str();
	dir=opendir(path);
	while((ptr=readdir(dir))!=NULL){
		
		//filePrefix=IC|IF|IH
		if(filePrefix.size()==2){
			if(ptr->d_name[0]=='I'&&ptr->d_name[1]==filePrefix[1]){
				string docName=ptr->d_name;
				readDocs.push_back(docName.substr(0,6));
			}
		}
		//filePrefix=*,means all
		else{
			if((ptr->d_name[0]='I')&&
				(ptr->d_name[1]=='C'|ptr->d_name[1]=='F'|ptr->d_name[1]=='H')){
				string docName=ptr->d_name;
				readDocs.push_back(docName.substr(0,6));
			}
			
		}
	}
}

你可能感兴趣的:(C++便利文件夹下文件)