Skip to content

Commit

Permalink
central functions for managing files
Browse files Browse the repository at this point in the history
  • Loading branch information
jgthomas committed Dec 30, 2018
1 parent 71a6dab commit 44fcf25
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
16 changes: 16 additions & 0 deletions io/files.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <stdio.h>
#include <stdlib.h>


FILE *load_file(char *file_stream_name, char *mode)
{
FILE *f_stream = fopen(file_stream_name, mode);

if (f_stream == NULL)
{
fprintf(stderr, "Failed to access file '%s'\n", file_stream_name);
exit(EXIT_FAILURE);
}

return f_stream;
}
6 changes: 6 additions & 0 deletions io/files.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef FILES_H
#define FILES_H

FILE *load_file(char *file_stream_name, char *mode);

#endif

0 comments on commit 44fcf25

Please sign in to comment.