代码拉取完成,页面将自动刷新
Lightweight, portable and easy to integrate C directory and file reader. TinyDir wraps dirent for POSIX and FindFirstFile for Windows.
Windows unicode is supported by defining UNICODE
and _UNICODE
before including tinydir.h
.
There are two methods. Error checking omitted:
tinydir_dir dir;
tinydir_open(&dir, "/path/to/dir");
while (dir.has_next)
{
tinydir_file file;
tinydir_readfile(&dir, &file);
printf("%s", file.name);
if (file.is_dir)
{
printf("/");
}
printf("\n");
tinydir_next(&dir);
}
tinydir_close(&dir);
tinydir_dir dir;
int i;
tinydir_open_sorted(&dir, "/path/to/dir");
for (i = 0; i < dir.n_files; i++)
{
tinydir_file file;
tinydir_readfile_n(&dir, &file, i);
printf("%s", file.name);
if (file.is_dir)
{
printf("/");
}
printf("\n");
}
tinydir_close(&dir);
See the /samples
folder for more examples, including an interactive command-line directory navigator.
ANSI C, or C90.
POSIX and Windows supported. Open to the possibility of supporting other platforms.
Simplified BSD; if you use tinydir you can comply by including tinydir.h
or COPYING
somewhere in your package.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。