From 06818a49b337ef5d3277ebf6ed0b3f13a88239d3 Mon Sep 17 00:00:00 2001 From: Nathan Vance Date: Mon, 27 Jul 2015 19:15:59 -0400 Subject: Updated to work with gcc 5.X --- log.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 log.c (limited to 'log.c') diff --git a/log.c b/log.c new file mode 100644 index 0000000..34f0647 --- /dev/null +++ b/log.c @@ -0,0 +1,18 @@ +#include +#include + +#define LOGFILE "7w.log" // all Log(); messages will be appended to this file + +int firstOpen = 1; + +void Log(char *message) { + FILE *file; + + if(firstOpen) + file = fopen(LOGFILE, "w"); + else + file = fopen(LOGFILE, "a+"); + firstOpen = 0; + fprintf(file, "%s\n", message); /*writes*/ + fclose(file); /*done!*/ +} -- cgit