Sun Jun 27 10:41:49 PDT 2004
[netwalk.git] / win32 / config_file.c
blob361cf88feb3ad10d08ad0625e64f4cf78eee4ef7
1 #include <stdlib.h>
2 #include "config.h"
4 #define DEFAULT_WINFONT "C:\\WINDOWS\\FONTS\\ARIAL.TTF"
6 char *config_file = "config";
8 FILE *config_get_fp()
10 FILE *fp;
12 fp = fopen(config_file, "r");
13 if (!fp) {
14 fp = fopen(config_file, "w");
15 if (!fp) {
16 fprintf(stderr, "Can't open or create config file\n");
17 exit(1);
19 fprintf(fp, "font %s\n", DEFAULT_WINFONT);
20 fprintf(fp, "fontsize 11\n");
21 fprintf(fp, "hiscores hiscores.txt\n");
22 fprintf(fp, "showmoves 0\n");
23 fclose(fp);
25 fp = fopen(config_file, "r");
26 if (!fp) {
27 fprintf(stderr,"Can't open config file %s\n", config_file);
28 exit(1);
32 return fp;