diff options
author | Cong <c_xong@hotmail.com> | 2013-02-03 12:51:33 +0400 |
---|---|---|
committer | Cong <c_xong@hotmail.com> | 2013-02-03 12:51:33 +0400 |
commit | bd983029faf0c9a7b28b640d71a6c12726082005 (patch) | |
tree | a5d2968e8347c730f8627a9eee39d467c7c2ad4d /README.md | |
parent | d02ba6702b2c0c75a22124ddfa7c79b0056f15cf (diff) |
Add interactive subdirectory open example; other fixes
Rename source files
Add sorted example to README.md
Fix sorting to be case insensitive
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 29 |
1 files changed, 25 insertions, 4 deletions
@@ -6,7 +6,7 @@ Lightweight, portable and easy to integrate C directory and file reader. Example ======= -Error checking omitted: +There are two methods. Error checking omitted: ```C tinydir_dir dir; @@ -30,6 +30,27 @@ while (dir.has_next) tinydir_close(&dir); ``` +```C +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); +``` + Language ======== @@ -48,6 +69,6 @@ BSD. Known Limitations ================= -Not threadsafe -Limited path and filename sizes -No wide char support +- Not threadsafe +- Limited path and filename sizes +- No wide char support |