ncurses-gameoflife/log.c

30 lines
385 B
C
Raw Permalink Normal View History

2020-07-01 08:49:06 +08:00
#include <stdio.h>
#include "log.h"
static FILE* file = 0;
static char* name;
void startLog(char* filename)
{
name = filename;
file = fopen(filename, "w");
}
2020-07-06 07:56:29 +08:00
void logString(char* string)
{
if (!file) return;
fputs(string, file);
}
2020-07-01 08:49:06 +08:00
void logLine(char* string)
{
if (!file) return;
fputs(string, file);
fputs("\n", file);
}
void endLog()
{
2020-07-01 09:01:04 +08:00
if (!file) return;
2020-07-01 08:49:06 +08:00
fclose(file);
}