0

this is my terminal window with the error when I run my program

This is what my terminal looks like when I compile and run my program. ('You messed up' is the error message I put in place for when in input dictionary is NULL)

enter image description here

This is my full ide window. I highlighted where the large dictionary is. I moved it into the speller folder from the dictionary folder.

2

This is likely not a code issue, but an issue with the location of the dictionary file. When you invoke speller, the dictionary specified (or default) needs to be in the location that is expected. If using the default, it needs to be in the directory specified in speller.c. Look for the #define DICTIONARYstatement. If you are providing the name of a dictionary without a path, it needs to be in the current dictionary. You get the idea.

Verify the locations of your dictionaries and go from there.

[EDIT following update]

Uhhuh. As I thought, the dictionaries are not where they are expected to be. Compare the hardcoded default location in speller.c to where the file is located:

Hardcode (at least, in the 2015 version):

/home/cs50/pset5/dictionaries/large

Your dictionary:

/home/cs50/pset5/speller/dictionaries/large

Again, answer these questions:

  1. What is the exact directory defined in your speller.c code for the default dictionary? (The current directory is NOT the default.)
  2. What is the exact directory path to your dictionary?
  3. Are they the same?

  4. Bonus question: Instead of using the default dictionary path/filename, have you tried invoking speller by explicitly specifying both the dictionary name and the target file name? Ex: ./speller large texts/holmes.txt

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

5
  • I moved both the small and large dictionaries into the same folder as speller.c, but I am still getting the same error. Any suggestions on what else to do? – Iris Frenzy Jul 11 '17 at 22:03
  • when you invoked ./speller, what was the exact command that you used? Also, what directory is speller in? It might be helpful if you grabbed a screenshot of the IDE (the whole window) showing what happens when you try to execute speller. Please edit the question and post the screenshot there. – Cliff B Jul 11 '17 at 22:30
  • I updated my question- thanks for trying to help me – Iris Frenzy Jul 11 '17 at 23:36
  • See edited answer. – Cliff B Jul 11 '17 at 23:51
  • Thank you for having so much patients with me! – Iris Frenzy Jul 12 '17 at 0:08

You must log in to answer this question.

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