0

I have a problem to open texts files related to pset5. I think that is nothing to do with my code. It's probably the way I ask in the command window or maybe my current directory. Is it the good way to run speller in gedit?

enter image description here

1

Yes, you're not giving the right parameters. There are two ways to invoke speller:

./speller  <file_to_test>
./speller  <dictionary_file>  <file_to_test>

You've been invoking with one or both parameters that don't lead to files. If you invoke with only one parameter, it will use the default dictionary, large. If you invoke with both parameters, there must be at lease one space between the two parameters. Finally, the test text files are located in the text subdirectory, assuming you have unzipped the files like everyone else and didn't move them.

The following should work:

./speller texts/austinpowers.txt

You can adjust the filename as you see fit to test other files in that directory. This is using a relative path to the file, relative to the current directory. You can also use an absolute path.

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

| improve this answer | |
0

I just had to cd pset5/speller and the command worked.

| improve this answer | |
  • that would only call the speller program if it were in a subdirectory called speller. In the questioner's case, it isn't. It would also fail because the target text file is in another directory. – Cliff B Nov 12 '17 at 0:04
  • I had the same issue and this worked for me. – Kraken Nov 12 '17 at 9:23
  • I'm sure it did. However, it would depend on them having the exact same file structure and the same files in the same places as you, which doesn't appear to be the case. – Cliff B Nov 12 '17 at 9:27
  • Actually in the cs50 class, we are required to maintain the same file structure. – Kraken Nov 12 '17 at 9:31

You must log in to answer this question.

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