https://github.com/sagiegurari/c_fsio
File System utility functions.
https://github.com/sagiegurari/c_fsio
c c-lib c-library filesystem filesystem-library
Last synced: over 1 year ago
JSON representation
File System utility functions.
- Host: GitHub
- URL: https://github.com/sagiegurari/c_fsio
- Owner: sagiegurari
- License: apache-2.0
- Created: 2020-09-24T14:40:36.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-27T07:11:11.000Z (almost 3 years ago)
- Last Synced: 2025-01-27T09:11:28.733Z (over 1 year ago)
- Topics: c, c-lib, c-library, filesystem, filesystem-library
- Language: C
- Homepage:
- Size: 67.4 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# fsio
[](https://github.com/sagiegurari/c_fsio/actions)
[](https://github.com/sagiegurari/c_fsio/releases)
[](https://github.com/sagiegurari/c_fsio/blob/master/LICENSE)
> File System functions and utilities.
* [Overview](#overview)
* [Usage](#usage)
* [Contributing](.github/CONTRIBUTING.md)
* [Release History](CHANGELOG.md)
* [License](#license)
## Overview
This library provides a set of utility functions to work with the file system.
This includes writing/append text files with automatic directory creation, creating full directory path and more.
```c
#include "fsio.h"
#include
#include
int main()
{
// simple examples of writing/appending/reading text files
char *file = "./somedir/myfile.txt";
bool done = fsio_write_text_file(file, "some text\n");
printf("Text file written: %d\n", done);
done = fsio_append_text_file(file, "more text\n");
printf("Text file appended: %d\n", done);
char *text = fsio_read_text_file(file);
printf("Read text:\n%s\n", text);
// creating a full directory path
done = fsio_mkdirs("./somedir/dir1/dir2/dir3", FSIO_MODE_ALL);
printf("Created directories: %d\n", done);
// chmod to all permissions recursively
done = fsio_chmod_recursive("./somedir/", FSIO_MODE_ALL);
printf("Chmod done: %d\n", done);
// recursive delete or files and directories
done = fsio_remove("./somedir");
printf("Deleted somedir and all content.\n");
}
```
## Contributing
See [contributing guide](.github/CONTRIBUTING.md)
See [Changelog](CHANGELOG.md)
## License
Developed by Sagie Gur-Ari and licensed under the Apache 2 open source license.