0

I've been doing some debugging using gdb using a small dictionary(about 80 words) and a small text file(quote.txt) when I run the program it works perfectly, however, when I use the large dictionary and austinpowers.txt, I get twice the misspelled words I should, and every "a" is counted as misspelled, for example.

I really don't know what's wrong, I thought I had fixed all bugs when debugging.

http://pastebin.com/HjXuyrPm

2

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. ;-)

1
  • You are right, there appears to be another problem,with handling apostrophes. I fixed the fgetc and fscanf problem and I'm getting 610 misspelled words, but it should be 644. I'll work on that. Jun 25 '16 at 10:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .