new file_handling method

This commit is contained in:
gandc 2025-02-27 20:29:21 +03:00
parent f329180197
commit cb20bd27b4
Signed by: gandc
GPG Key ID: 9F77B03D43C42CB4
2 changed files with 16 additions and 0 deletions

11
src/file_handling.c Normal file
View File

@ -0,0 +1,11 @@
#include "file_handling.h"
#include <stdlib.h>
#include <stdio.h>
FILE *open_file(const char *path, const char *mode, const char *error_message) {
FILE *file = fopen(path, mode);
if (!file) {
perror(error_message);
}
return file;
}

5
src/file_handling.h Normal file
View File

@ -0,0 +1,5 @@
#ifndef FILE_HANDLING_H
#define FILE_HANDLING_H
#include <stdio.h>
FILE *open_file(const char *path, const char *mode, const char *error_message);
#endif