当前位置: 首页 > 软件库 > 应用工具 > 文件管理器 >

tinydir

授权协议 View license
开发语言 C/C++
所属分类 应用工具、 文件管理器
软件类型 开源软件
地区 不详
投 递 者 步德宇
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

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

相关阅读

相关文章

相关问答

相关文档