vector
{
DIR* dir = NULL;
struct dirent entry;
struct dirent* entryPtr = NULL;
dir = opendir(strDir.c_str());
if (NULL == dir)
{
return false;
}
readdir_r(dir, &entry, &entryPtr);
while (entryPtr != NULL)
{
string strFileName = entry.d_name;
if ("." == strFileName || ".." == strFileName)
{
}
else
{
vecFileName.push_back(strFileName);
}
readdir_r(dir, &entry, &entryPtr);
}
return true;
}[/code]该函数得到指定目录下的所有文件名,放把它们放到 vector 中。