LordOfTrident / cfs

A cross-platform filesystem library for C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

!This project has been moved to chol!

cfs

License Issues GitHub pull requests


A simple single-header STB-style cross-platform C filesystem library.

Table of contents

Simple example

#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

Quickstart

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

Bugs

If you find any bugs, please create an issue and report them.

About

A cross-platform filesystem library for C

License:GNU General Public License v3.0


Languages

Language:C 100.0%