i have been working on it for weeks now but for the past few days i have been just trying to find an error.. My program is returning all the words as misspelled.. any help would be highly appreciated This is my code..http://pastebin.com/Ffby8wda
The problem originates with a misunderstanding of how fgets() works. When fgets() executes, it reads in an entire line from the input file, and stores it in the buffer. Since each line contains only one word, it is storing each word, one at a time, as it should. The problem is that it is also storing the '\n' at the end of each line before storing the '\0' end of string marker.
Now, let's move on to check(). Let's say the code is processing "cat" which is in the text to check and in the dictionary. When check() executes, it's going to compare "cat" to "cat\n" and fail. It doesn't matter what word is being checked, it will always fail for the same reason.
Remove the '\n' from the word before you store it and it should cure that problem. No guarantees that there are other issues. ;-)
If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)