From 12c1b5810fac956a374ce4a20362187f48bd7ef1 Mon Sep 17 00:00:00 2001 From: Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> Date: Sun, 28 Apr 2024 22:09:05 +0000 Subject: Sun, Apr 28, 2024, 3:09 PM -07:00 --- wk5/pset/speller/dictionary.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'wk5/pset/speller/dictionary.c') diff --git a/wk5/pset/speller/dictionary.c b/wk5/pset/speller/dictionary.c index 16d3547..a6c4d34 100644 --- a/wk5/pset/speller/dictionary.c +++ b/wk5/pset/speller/dictionary.c @@ -51,12 +51,23 @@ bool load(const char *dictionary) } //read each word in dictionary - char c; - while(fscanf(source, "%s", word) != ) + char word[LENGTH + 1]; + while(fscanf(source, "%s", word) != "E0F") + { + malloc + } /* use fscanf(file, "%s", word) to grab words - + check for ended file + create new node + use malloc + check if return is NULL + copy word from fscanf into node using strcpy + use hash function + function takes string and returns index + insert node into hash table + HOW */ // Close the dictionary file -- cgit v1.2.3