diff options
author | Nathan Vance <nathav63@gmail.com> | 2015-07-27 19:15:59 -0400 |
---|---|---|
committer | Nathan Vance <nathav63@gmail.com> | 2015-07-27 19:15:59 -0400 |
commit | 06818a49b337ef5d3277ebf6ed0b3f13a88239d3 (patch) | |
tree | 500f311c25ac68fc9a3b8429bf0747572e4d3e69 /log.c | |
parent | fixed bugs and formatting errors (diff) | |
download | 7w-06818a49b337ef5d3277ebf6ed0b3f13a88239d3.tar.gz 7w-06818a49b337ef5d3277ebf6ed0b3f13a88239d3.tar.bz2 7w-06818a49b337ef5d3277ebf6ed0b3f13a88239d3.zip |
Updated to work with gcc 5.X
Diffstat (limited to 'log.c')
-rw-r--r-- | log.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -0,0 +1,18 @@ +#include <stdlib.h> +#include <stdio.h> + +#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!*/ +} |