项目
在 GitHub 查看
cxong/tinydir
关于
轻量、可移植且易于集成的 C 目录和文件读取器。
系统与基础设施实测星标增长
- 24小时
- 0
- 7天
- -1
- 15天
- -1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文TinyDir
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.
Example
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.
Language
ANSI C, or C90.
Platforms
POSIX and Windows supported. Open to the possibility of supporting other platforms.
License
Simplified BSD; if you use tinydir you can comply by including tinydir.h or COPYING somewhere in your package.
Known Limitations
- Limited path and filename sizes
- Possible race condition bug if folder being read has changing content
- Does not support extended-length path lengths in Windows - paths are limited to 260 characters. See https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry
探索相关项目
加载中…