Git Product home page Git Product logo

tinydir's Introduction

TinyDir

Build StatusProject Stats

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

tinydir's People

Contributors

cxong avatar lautis0503 avatar amdg2 avatar andargor avatar wjwwood avatar dariomanesku avatar bitdeli-chef avatar besser82 avatar czipperz avatar cg505 avatar gfdevelop avatar isty001 avatar praihan avatar cosmy1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.