tinydir, 轻量级便携和易于集成C目录和文件阅读器。用法:
void get_file_names(string dir_name, vector & names)
{
names.clear();
tinydir_dir dir;
tinydir_open(&dir;, dir_name.c_str());
while (dir.has_next)
{
tinydir_file file;
tinydir_readfile(&dir;, &file;);
if (!file.is_dir)
{
names.push_back(file.path);
}
tinydir_next(&dir;);
}
tinydir_close(&dir;);
}
1