When I run speller.c it says it could not load dictionary. I can't find the dictionaries anywhere in the appliance. Home directory only has jharvard in it and when I put gedit ~cs50/pset6/dictionaries/large in the command line, it just opens an empty file in gedit.

  • Try executing update50 first and make sure the file named large exists under ~cs50/pset6/dictionaries/! – kzidane Sep 16 '14 at 13:36
  • I already did that, hasn't made a difference :( – boopboop Sep 16 '14 at 13:37
  • When you execute cd ~cs50/pset6/dictionaries in the terminal then ls, does a file named large appear there? – kzidane Sep 16 '14 at 13:38
  • no, it just says the directory wasn't found. I'll try updating again in case there was a problem first time around. – boopboop Sep 16 '14 at 13:40

It looks like the problem here is how you're using the tilde ~ character; you need to separate it from the cs50 subfolder with a forward-slash / character.

The tilde ~ is a special character recognized by the cs50 appliance's command-line interpreter, or shell, as a shortcut for your home directory. When you issue a shell command with an unquoted tilde, the interpreter replaces that special character with the contents of the $HOME environment variable.

When you are logged into the appliance normally, the $HOME environment variable should contain the path /home/jharvard. You can check this by issuing the commands echo $HOME and echo ~ in the shell; they should both print the same path.

However, if you try echo ~cs50 you'll see that the special character is not expanded. The interpreter only treats it as a shortcut for your home directory when used on its own or in place of a folder name at the beginning of a file path. You're allowed to use the tilde ~ character in file names, so the interpreter won't expand the tilde in ~cs50 in case there is a file named ~cs50 that you're trying to access.

This is the case with all relative path shortcuts - e.g., to run a file in your current directory, you would issue the command as ./filename rather than .filename. It is possible to create files with the same name as these shortcuts, by escaping or quoting the special characters, but this is a very bad idea; it confuses users and in the worst case could lead to accidental deletion of the home directory.

  • I've done update50. I've verified that $HOME and echo ~ yield the same result. But when I look into /home/cs50/pset6, all I find are the files huff and puff. If I look into /home/cs50/pset5, there I find the dictionaries. Not sure what is going on here.jharvard@appliance (/home/cs50/pset6): ls huff puff jharvard@appliance (/home/cs50/pset6): cd /home/cs50/pset5 jharvard@appliance (/home/cs50/pset5): ls challenge dictionaries speller texts jharvard@appliance (/home/cs50/pset5): – rl777 Nov 12 '14 at 18:12
  • @rl777 Interesting; if you open another question, I'm sure we'll be able to solve this for you. – Air Nov 12 '14 at 18:21

You must log in to answer this question.

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