new file_handling method
This commit is contained in:
parent
f329180197
commit
cb20bd27b4
11
src/file_handling.c
Normal file
11
src/file_handling.c
Normal 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
5
src/file_handling.h
Normal 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
|
||||
Loading…
x
Reference in New Issue
Block a user