Linux下获取路径文件夹所有的文件
void GetFileNames(string path,vector<string>& filenames)
{
DIR pDir;
struct dirent ptr;
if(!(pDir = opendir(path.c_str())))
return;
while((ptr = readdir(pDir))!=0) {
if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0)
filenames.push_back(path + "/" + ptr->d_name);
}
closedir(pDir);
}