file.h (560B)
1 #ifndef __SFINX_UTIL_FILE_H__ 2 #define __SFINX_UTIL_FILE_H__ 3 4 #include <stddef.h> 5 #include <stdint.h> 6 7 // File {{{ 8 // 9 // Whole-file IO for the CLI, "-" or NULL means stdin or stdout 10 // read mallocs len + 1 and NUL terminates, write sets the mode and O_EXCL 11 // exists answers whether a path is already taken 12 13 int util_file_read(const char *path, uint8_t **out, size_t *len_out); 14 int util_file_write(const char *path, const uint8_t *data, size_t len, unsigned mode, int force); 15 int util_file_exists(const char *path); 16 // }}} 17 18 #endif // __SFINX_UTIL_FILE_H__