I'm not sure exactly what's going on, but there's definitely an issue with the way load is reading data from the dictionary file. The code reads in a single char at the while(fgetc(diction)!= EOF)
line, and then reads the rest of the word at fscanf(diction, "%s", node_1->word);
. A word like cat
becomes at
and a single letter word is loaded as an empty word. Strangely, sometimes it works and other times it doesn't. I haven't figured out why, but I'm getting lazy and it would take me a while to get to the bottom of it. ;-) Anyways, this is almost certainly the root of the problem.
Instead of the two reads, why not incorporate the fscanf into the while setup and eliminate the fgetc read?
There may be other issues, but this needs to be fixed first.
If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)