diff options
author | rafa_99 <rafa99@protonmail.com> | 2020-11-22 13:59:43 +0000 |
---|---|---|
committer | rafa_99 <rafa99@protonmail.com> | 2020-11-22 13:59:43 +0000 |
commit | 596b63a8700e2953ce81b65f46a5b3015d45d904 (patch) | |
tree | 69914e1beaad9e15ce6dbd2ce2ce470c30b02504 /ouija.c | |
parent | 41b6afe198856399aaaa35a51ad9becda6d9e8e0 (diff) |
Updated Some Bad Written Code
Diffstat (limited to 'ouija.c')
-rw-r--r-- | ouija.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -1,31 +1,30 @@ -#include "logic.h" -#include <stdlib.h> +#include "session.h" #include <stdio.h> -#include <string.h> +#include <stdlib.h> 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; |