0

My command line syntax is "./speller dictionaries/small.txt test"

If I could PM someone my full code, I'd really appreciate it. I'm getting the error "Could not open dictionary."

First lines of my load function:

bool load(const char* dictionary) { FILE* inptr = fopen(dictionary, "r"); if (inptr == NULL) { printf("Could not open dictionary.\n"); return false; } ... btw my function does, indeed, return true at the end.

1 Answer 1

1

I don't think that this is a code problem, but is a file name problem. I believe the dictionary name is small, not small.txt.

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

5
  • if I do that, I get a seg fault. Commented Nov 8, 2016 at 6:30
  • Well, that means two things. It opened the dictionary file, and there's a bug in your code.
    – Cliff B
    Commented Nov 8, 2016 at 6:38
  • hmm, apparently "test" isn't a valid file name. I thought I was simply providing a text string. If I load "alice.txt" from the keys folder the program does run. But now it says there are 0 words in my dictionary. any ideas? Commented Nov 8, 2016 at 6:42
  • That would be a totally new question and would require that you post code to be tested.
    – Cliff B
    Commented Nov 8, 2016 at 6:45
  • Am I allowed to post my entire code? It's probably only incorrect by like 1 line. Commented Nov 8, 2016 at 6:46

You must log in to answer this question.

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