From 596b63a8700e2953ce81b65f46a5b3015d45d904 Mon Sep 17 00:00:00 2001 From: rafa_99 Date: Sun, 22 Nov 2020 13:59:43 +0000 Subject: Updated Some Bad Written Code --- ouija.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'ouija.c') diff --git a/ouija.c b/ouija.c index 123a705..74b66ff 100644 --- a/ouija.c +++ b/ouija.c @@ -1,31 +1,30 @@ -#include "logic.h" -#include +#include "session.h" #include -#include +#include int main(int argc, char **argv) { - char *dictionary = (char *)calloc(MAX_LINE, sizeof(char)); + FILE *dictionary = NULL; switch (argc) { case 1: if (checkIfFileExists("dictionary.dict") == 0) { - strcpy(dictionary, "dictionary.dict"); + dictionary = fopen("dictionary.dict", "r"); } break; case 2: if (checkIfFileExists(argv[1]) == 1) { - strcpy(dictionary, argv[1]); + dictionary = fopen(argv[1], "r"); } } if (dictionary != NULL) { - char *string = getLine(dictionary, getRandomNumber(1, lineCounter(dictionary))); - free(dictionary); + startSession(dictionary); + fclose(dictionary); } return 0; -- cgit v1.2.3