!This project has been moved to chol!
A simple single-header STB-style cross-platform C filesystem library.
#include <stdio.h> /* printf */
#define CFS_IMPLEMENTATION
#include "cfs.h"
int main(void) {
fs_dir_t dir;
fs_dir_open(&dir, "./");
fs_ent_t ent;
while (fs_dir_next(&dir, &ent) == 0)
printf("%s\n", ent.name);
fs_dir_close(&dir);
return 0;
}
Output
Just copy cfs.h
into your project or submodule this repository and include the header.
See the examples to see how to use the library.
To compile and run the examples, run
$ cc ./examples/ls.c -o ls
$ cc ./examples/copy.c -o copy
$ cc ./examples/link.c -o link
$ cc ./examples/join.c -o join
$ cc ./examples/foreach.c -o foreach
$ ./ls
$ ./copy
$ ./link
$ ./join
$ ./foreach
If you find any bugs, please create an issue and report them.