Added logging functionality.

This commit is contained in:
Sheldon Lee 2020-07-01 01:49:06 +01:00
parent c68216afa6
commit 49cced6b4f
2 changed files with 32 additions and 0 deletions

22
log.c Normal file
View File

@ -0,0 +1,22 @@
#include <stdio.h>
#include "log.h"
static FILE* file = 0;
static char* name;
void startLog(char* filename)
{
name = filename;
file = fopen(filename, "w");
}
void logLine(char* string)
{
if (!file) return;
fputs(string, file);
fputs("\n", file);
}
void endLog()
{
fclose(file);
}

10
log.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef LOG_H
#define LOG_H
void startLog(char* filename);
void logLine(char* string);
void endLog();
#endif