Questions tagged [load]

the first part of pset5, loading a dictionary into memory

Filter by
Sorted by
Tagged with
0
votes
1answer
274 views

Last try, Pset 5 load, check

I'v spent days trying to fix this, with one bug after the other and still havent been able to solve it. I'd be grateful if anyone can tell me what I'm doing wrong. Some stuff I found out :- 1) At ...
0
votes
1answer
293 views

The load function in dictionary.c is segfaulting. 3 tfs have looked over my code and none can figure out what's going on. Can anyone help?

This is how I've implemented my load function: bool load(const char* dictionary) { // Open file FILE* input = fopen(dictionary, "r"); if (input == NULL) { return false; } ...
0
votes
1answer
353 views

Pset5 load, free!

I'm doing pset5 and there's something wrong with my load function.I'm getting some error which I think means I'm freeing memory twice but I cant understand what I'm doing wrong. bool load(const char* ...
0
votes
2answers
584 views

Pset5 check function, and probably load

Ok...I'm doing pset5 and I'v already done the load function though I think there's something wrong with it.When I run speller it gives a seg fault in check function.Something to do with strcmp ...
0
votes
1answer
246 views

Problems with letters “a” and “I” misspellings

My program loads and checks correctly with small texts and the large dictionary. Although when I load large texts, for some reason calls misspelled for the letters "a" and 'I'. I'm struggling with ...
0
votes
1answer
250 views

Pset5 seg fault, load function

I'm doing pset5 and I'm currently implementing the load function. bool load(const char* dictionary) { typedef struct node{ struct node* next; char word[46]; }node; FILE* ...
1
vote
1answer
263 views

pset5 - possessives and substrings

I have posted this questions a few days ago, but none of us were getting anywhere. I thought maybe including my code for load as well as check might yield some new revelations. Anyway, here is the ...
0
votes
1answer
158 views

12905 misspelled words, 7 unload errors. Having issues with load()

I've been working on dictionary.c for pset5 here. I believe most of my issues are caused by my load() function, but I can't pinpoint an issue. Maybe I'm crawling through my Trie wrong. A point in the ...
0
votes
1answer
1k views

pset5: dictionary not loading correctly

I took a bit of a break from cs50 and having come back to it I realised that there is a problem with my load function in pset5. Although the program tells me correctly which words are misspelled, the ...
0
votes
1answer
305 views

using root and current nodes in check when not declared until load

So i have used a trie structure for this pset. And i have declared my struct node in the load section as well as root and current which are nodes. I've written my code for check but I need to access ...
0
votes
1answer
281 views

pset6 Internal Server Error

I'm working my way through the web server and am getting behavior I don't understand. I am consistently receiving a 500 error whatever I try to load in Chrome. I've added printf's (yes, I'm one of ...
0
votes
1answer
214 views

Cannot clear segmentation fault in load pset5

I use a simple (or so I thought) code to load the dictionary, no optimization. Yet I keep getting into segmentation fault. In this example I use the small dictionary, which only has 2 words. In my ...
0
votes
2answers
56 views

Exiting nested loops

I started off pset5 with a really simple hash function, where words are indexed according to their first letter, so a would be 0, b = 1 etc. Then I insert a piece of code into the load function, which ...
0
votes
1answer
92 views

overwriting nodes in load function

i have a problem in my load function. if i load the word (cat),it loads successfully. but when i load the word (caterpillar) after that,gdb shows me that the first 3 letters are allocated again . the ...
0
votes
1answer
526 views

Pset5: problem with inserting words into nodes

To start off, I'm not even sure if the reasoning behind this is correct because I felt totally lost at the beginning of the pset, but the program won't even compile because of this error: ...
0
votes
1answer
1k views

Inserting word into hash array, and linked lists

Ok, I got most of load working. I figured out the hash function, but now I am a little stuck. If you look at "HELP", you will see that I do not know the code syntax to insert my word into the ...
1
vote
0answers
535 views

pset6(Web Server) - Load function does not work [duplicate]

For some reason the load function within the distro does not seem to work and I cannot load files I'm attempting to access through a web browser. When I attempt to access content the web browser ...
0
votes
1answer
588 views

Problem Set 5: Speller, Segmentation fault

I'm working through the "load" part of speller.c and running into problems... Here is a tiny snippet of my code to avoid breaking any rules: My hash_values are simple so A = 0, B = 1 C = 2 etc, and ...
0
votes
1answer
60 views

Initializing multiple variables inside a for loop

I have been working on the dictionary's "load" function in Problem Set 5, but I have a problem. I don't want to hard-code names for each node within my trie, which I am working on, but in order to ...
0
votes
1answer
593 views

Pset5 dictionary.c load Should I throw my code away or am I on the right track?

I battled the compiler for a full day to eliminate all the syntax errors in my load function. Does my pseudo-code look correct and does it match my code? Pseudo-code: each node struct contains a ...
0
votes
2answers
393 views

pset5 valgrind not happy with load (also, using malloc vs calloc on trie)

First, valgrind flags the file pointer at the fopen call, and also the malloc call to the root pointer. It designates both still reachable in loss record. Second, since for pset5 I check for an end ...
0
votes
1answer
643 views

Speller - trie implementation - Segmentation Fault

Having some trouble with a trie implementation of speller pset5 (2014). It seems to almost work, finding misspelled words, but then I get a segfault. It appears I have some memory problems, and I ...
0
votes
1answer
195 views

2014 pset5: Double free in load

I can't seem to figure out how to allocate and free memory correctly when I'm using a linked list node (a pointer inside a struct). When I can get my code to run without error I am getting major ...
0
votes
1answer
722 views

pset5 trie load function killed with large dictionary

This has been bugging me for weeks. The program seems to run OK with small dictionaries, but gets killed with medium size - after around 95,000 words - it varies. LETTERS is set to 27. Any help would ...
1
vote
1answer
503 views

how to compile dictionary.c? [duplicate]

I'm having trouble figuring out the problem with my load function. here's the weird error I get (I've never seen something like it): jharvard@appliance (~/Dropbox/pset5): make dictionary clang -ggdb3 ...
0
votes
1answer
71 views

How do I pass back the location of my loaded dictionary?

I have (hopefully) loaded the dictionary correctly, but I'm not clear on how to identify its location in memory without changing the declaration of the load function? More concretely, in my code for ...
0
votes
1answer
168 views

Trie Spellchecker unload() - two allocs not freeing

My freeNode() function goes through each child of my root node and free()'s each of them from the bottom back up to the root. Two of the allocs are not being free()'d. #include <stdbool.h> #...
0
votes
1answer
612 views

Can't make Valgrind happy in Speller (pset5)

I'm working through ./speller in pset5, mainly the load() function. My function loads the dictionary without any issues, and Valgrind even shows no memory leaks. The problem is I have a ridiculous ...
0
votes
1answer
96 views

End of file not found, why?

Help! i'm completely stuck is this code. After using a lot of gdb, i found out that when the end of file is reached the for loop (for(letter = fgetc(inptr); letter != '\n'; letter =fgetc(inptr)) //...
0
votes
1answer
535 views

Can I test implementation of load function in pset5 prior to completing check, size and unload

I have finished coding the load function for pset5 dictionary.c and want to see if it works (and confirm I am on the right track) before I go onto the other functions. I tried to execute speller.c but ...
0
votes
1answer
193 views

pset5 why only strcpy works

In load, when I assign the word I loaded from dictionary to new_node, I originally used new_node->word = new_word but an error told me that it is non assignable. However, when I use strcpy it ...
1
vote
1answer
378 views

pset5 seg fault when loading a dictionary

When I run my load function with ./speller text, it reported segmentation fault. When I use valgrind to check, it told me that the problem in the two line: char new_word[LENGTH + 1]; while(fgets(...
1
vote
2answers
3k views

Try to use trie in pset5

I know if I want to use trie in pset5 to load the dictionary, there should be a struct containing an array of pointers for the alphabets or the apostrophe and a variable of bool. The question is, ...
0
votes
1answer
547 views

Insert nodes into trie for Load

I'm not quite sure how to iterate through a string and malloc a new node to properly insert each letter into a trie for pset5/6 (2014/15). Here is the relevant code that I've come up with so far, ...
1
vote
1answer
219 views

How can I avoid segfaults when sorting my linked list?

I have been working hard with speller but I am stuck when it comes to inserting the nodes in alphabetical order. I am pretty sure I am doing something wrong, but I am not sure exactly where the ...
0
votes
1answer
86 views

PSET6: Load segfaults when I try to access variable in node

The relevant snippet of my load function: FILE* dict = fopen(dictionary, "r"); bool complete = true; for (int c = fgetc(dict); c != EOF; c = fgetc(dict)) { node* head = malloc(...
-1
votes
2answers
69 views

Initializing struct globally in pset6: trouble with persistent values of root

I'm implementing a trie for pset6. load works properly as far as I can tell. (gdb, valgrind both fine with it, and the #of words loaded comes out right as well). check, however, generates a ...
0
votes
2answers
1k views

Could not load dictionary in cs50 pset6

I have written the load code for pset6 which compiles but when I execute speller.c it returns "Could not load dictionary". I have tried using a homemade dictionary on my machine and the dictionary at ...
0
votes
1answer
154 views

trie does not assign pointers correctly in load and produces seg fault

I ran speller through gdb and keep getting seg fault at if(ptr->children[position] == NULL). I can't figure out why. It works when I use !ptr instead though. Another problem I encounter is that the ...
1
vote
2answers
218 views

unable to load small dictionary

I'm starting on pset6 and planning to use a trie to load the dictionary. I wrote a little code and wanted to test it as follows but it did not print the correct words. The test was done with the small ...
0
votes
2answers
323 views

Segmentation fault in `load` function of pset6

When I try to run my program, a segmentation fault results. I don't think I am accessing memory that I am not supposed to. Is my code fundamentally wrong? bool load(const char* dictionary) { FILE*...
0
votes
1answer
240 views

What might be wrong with this pset6 load hash function?

I'd like to use (with attribution) in my "load" section a hash function that I found online. When I try to compile it with Make, I get this: jharvard@appliance (~/Dropbox/pset6): make loadcbook ...
1
vote
1answer
207 views

Return value of load()

I just finished implementing load() in problem set 6. However there is still one thing I'm still not sure about: When I finish loading the dictionary file, should I return True or return the actual ...
0
votes
1answer
766 views

load function does not load the dictionary

I have a question concerning my load function. I get the error that the dictionary does not load. Does anyone recognize the mistake? Thank you for helping. #include <stdbool.h> #include <...
0
votes
1answer
256 views

pset6 load seg faulting when accessing malloc'd node

I need some guidance on where I'm going wrong here. GDB runs fine until I try to access the "next" property of a node to see if it's NULL. Am I just confusing how the node structure works? My ...
0
votes
1answer
93 views

Garbage values when creating new node

So, for my load function in pset6, I'm creating a new node for the current char if it isn't found in the children. node* node_cur = &root_node; loop iterate over chars in word { if(node_cur-...
0
votes
1answer
231 views

How do I load words in speller that are mixed letters and numbers?

I'm struggling with pset 6 (quite difficult logical and implementation wise, but I like this level of difficulty and this challenge). I'm implementing load and I just found out that I'm 34 words off ...
0
votes
1answer
1k views

Pset 6 - Spell-checker load()

I'm having some problems with spell-checker(pset 6). I'm trying to debugg with gdb, but when I try to run ./spell with gdb the following happens: Reading symbols from /home/jharvard/Dropbox/C/Harvard/...
1
vote
1answer
1k views

Pseudocode for Load Function in PSet6

I have hit the wall with the LOAD FUNCTION of PSet6. Does the following pseudocode look correct? Thanks for guidance. open dictionary file. create a node struct create an array of list_pointers (...
4
votes
1answer
532 views

Improve load time in pset6

So I'm in pset6 and my time is 0.01 seconds slower by the staff's implementation. Should I try to improve it more? Does it matter? If I should improve more how can I do it? Particularly in load as ...

1
4 5 6 7
8