diff options
author | Christian C <cc@localhost> | 2025-03-05 13:22:37 -0800 |
---|---|---|
committer | Christian C <cc@localhost> | 2025-03-05 13:22:37 -0800 |
commit | 3a61b957905ed1952f6ec15f684a03bf0f55a2ba (patch) | |
tree | d3a0ec65d6693cb82c98deb61e0caac960aae0ca /src/lib | |
parent | 18f1ffd5da6e032f5ce461cda216a1cfa4474413 (diff) |
Dump output to file
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/file.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/file.c b/src/lib/file.c new file mode 100644 index 0000000..b6ec1d0 --- /dev/null +++ b/src/lib/file.c @@ -0,0 +1,15 @@ +#include <lib/file.h> +#include <stdio.h> + +// Write array to a file +bool_t write_array(char* output_file_name, void* array, size_t size) +{ + FILE *file = fopen(output_file_name, "wb"); + if (file == NULL) { + fprintf(stderr, "Error opening file %s\n", output_file_name); + return FALSE; + } + fwrite(array, size, 1, file); + fclose(file); + return TRUE; +} |