It took me about a week to figure out that the files for what was formerly pset6 had been moved to the pset5 folder, and that's why my code couldn't open them. Now, however, it is still not opening. I realize #define for the files is not going to work in the long-term, I was just trying to get load to work on one file for now. Apologies in advance if I fumble pasting in this code snippet, I am new to this:
Thank you for your help!
// default text
#define text "/home/cs50/pset5/texts/quote.txt"
#define dict "/home/cs50/pset5/dictionaries/small"
// typedef a node for the hash table
typedef struct node
{
char word[LENGTH + 1];
struct node* next;
}
node;
// Define hash table
node* hashtable[TABLE_SIZE];
// Function declarations
int hash_it(char* needs_hashing); // Hash function
bool hashtable_add(int hashed, char word); // Loop to add to table
// Global variable for the head of the list
node* head = NULL;
node* new_node = NULL;
int main(int argc, char* argv[])
{
// open the dictionary
FILE* dictfile = fopen(dict, "r");
if (dictfile == NULL)
{
printf("Could not open %s.\n", dict);
//unload();
return 1;
}
// repeat until the end of the dictionary
while(!feof(dictfile))
{
// read string from file
fscanf(dictfile, "%s", new_node->word);
// try to open text
FILE* fp = fopen(text, "r");
if (fp == NULL)
{
printf("Could not open %s.\n", text);
//unload();
return 1;
}