Questions tagged [load]

the first part of pset5, loading a dictionary into memory

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

Pset5: check returns hashtable pointers as NULL despite hashtable values printed correctly in load

My check function returns all hashtable indexes as NULL (I printed a known index of 124 and still returns NULL), despite all indexes printed correctly in load. I am not sure where exactly the problem ...
0
votes
0answers
13 views

trouble loading dictionary

my load function seems to only load two words and all words are coming back misspelled. I don't know if the problem is with my load function or the hash function. I've gone over the load function ...
0
votes
1answer
12 views

My load function is licking memory

the program complies properly but when i use valgrind shows am leaking memory when I open the file in the FILE *file = fopen(dictionary, "r"); bool load(const char *dictionary) { // TODO ...
0
votes
0answers
18 views

Pset5: Problem with loading multiple words with the same hash number

I am having problems with loading multiple words with the same hash code. The hash function I chose, from what I can understand, takes the ascii codes of all of the words in the dictionary, and ...
0
votes
0answers
34 views

CS50 pset5 Speller - Code Does Not Compile Due to Issue with Hash Table/Load Function

I've been working on Speller for a little while now, but I've run into a roadblock. I finished my first draft of speller and have been clearing up errors until this point. Here's my dictionary.c so ...
0
votes
1answer
20 views

cs50 Speller Question

I am currently working on the load function in Speller. When I run it with a file, most of the words are mispelled, leading me to believe that initializing my list works correctly, until it adds ...
0
votes
1answer
48 views

Speller pset 5: Valgrind gives me error

I am doing pset 5 speller and It seems to be okey less valgrind check. Valgrind HELP50 gives me these errors ==22585== Use of uninitialised value of size 8 ==22585== at 0x40110B: hash (dictionary.c:...
0
votes
1answer
52 views

PSET 5 Speller - Unload leaking a ton of memory

I've been trying to read other questions on stack exchange about it and do research on it but I really couldn't find a solution for my unload problem. It doesn't seem to unload much. I tried a lot of ...
0
votes
0answers
39 views

PSET5 dictionaries won't load

I cannot get my dictionaries to load and cannot figure out why. Here is my load function: // Loads dictionary into memory, returning true if successful else false bool load(const char *dictionary) { ...
0
votes
1answer
57 views

Pset5: Speller. incorrect counting of mispelled words

I've been working on this code for the last two weeks... I load the correct # of words into the dictionary, but I get an incorrect number for misspelled words. I believe its an issue either with my ...
0
votes
1answer
57 views

Speller week 5 Segmentation fault

I can't understand where and what my error is I think it's because of "load", but I can't fix it it returns an error when checking :) dictionary.c, dictionary.h, and Makefile exist :) ...
0
votes
3answers
128 views

PSET 5 Hash help

I started my load function without looking at any reference code (first time starting a pset this way) to give me an idea on how to implement my own version. I was mostly confident until I reached the ...
0
votes
1answer
29 views

Pset5 segmentation fault due to sprintf

// Loads dictionary into memory, returning true if successful else false bool load(const char *dictionary) { int i; for (i = 0; i < 5382; i++) { table[i] = NULL; } int ...
0
votes
2answers
35 views

strcpy not working with struct items

bool load(const char *dictionary) { char splitStrings[9999][45]; FILE* dict = fopen(dictionary, "r"); node* item = table[0]; int i = 0; for (i = 0; fscanf(dict, "%...
0
votes
1answer
92 views

pset5 speller, passes all Check50 requirements except the last one (Valgrind)

My code is now working fine but misses out on fully completing Check50 because of the last requirement. Running ~/pset5/speller/ $ help50 valgrind ./speller texts/cat.txt, it returns: ==6259== ...
0
votes
1answer
37 views

PSet5 Speller, Load Function, help50 Valgrind returns “==2480== Conditional jump or move depends on uninitialised value(s)” at the strcpy line

I've been working on Speller for a while now, but I've been stuck on this same problem. When testing my code by running ./speller texts/ANYOFTHETEXTS, it says I load 143092 words, but it also always ...
0
votes
1answer
51 views

Speller.c doesn't work

I've spent pretty much time trying to solve a speller and got really stuck, don't know what's wrong with my code. It compiles but check50 says it's totally incorrect. I would be grateful if you could ...
0
votes
1answer
32 views

PSET 5 segmentation fault on checker

I figured out that the problem is the checker. The output of this code is a segmentation fault. I think I followed everything on the walkthrough. Here is the result that I got: the result of the code. ...
0
votes
1answer
91 views

CS50 Speller Load function

I looked through my load function with debug50 and realised that each time the loop is iterated, the pointer temp always gets assigned the same value despite freeing it, how do Igo about resolving ...
0
votes
2answers
36 views

PSET5 - Valgrind error - no enough bytes are being freed

I've been on this pset for some time now and everythin seems to be working except that there are some memory leaks and I really can't understand why. I've checked a lot of other people's codes but I ...
0
votes
1answer
41 views

Speller Load doesn't see certain words

My load function sometimes overlooks certain words in the dictionary. For example it jumps over the word "nodes" instead of loading it into the hash table. bool load(const char *dictionary) { // ...
0
votes
2answers
54 views

load function in speller not working properly not seem to figure out the correct way to link hastable?

Implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <strings.h> #...
3
votes
1answer
667 views

Help with PSet 5 2020 - Speller - Check & Unload Functions (EDIT: logic error in Load Function)

EDIT: Fixed the problem. The issue was not with the check or unload function but with the load function which had a small but very significant logic error. Figured it out with some great help from a ...
0
votes
1answer
28 views

speller giving error on valgrind, using 4 bytes of memory that isn't yours…indexing an array out of bounds

I think the problem with is the load() function, here is my code: bool load(const char *dictionary) { char *s = malloc(LENGTH + 1); FILE *f = fopen(dictionary, "r"); if (f == NULL) { return false;...
0
votes
1answer
96 views

PSET5 - Speller - Doesn't display anything past MISSPELLED WORDS

I've been debugging for quite a while now and can't seem to figure out the solution to this problem. When I use the large or small dictionary on any of the texts, the program becomes stuck at ...
0
votes
0answers
39 views

pset5 speller issue

#include <stdbool.h> #include <stdlib.h> #include <stdio.h> #include "dictionary.h" #include "string.h" #include <cs50.h> #include <strings.h> typedef struct node { ...
0
votes
0answers
19 views

Pset5 - Segmentation fault (Load function) - Using a for loop to make all elements of table[i] = NULL

The following is my load function and I am having a segmentation fault when I run the executable code by typing for example when I type ./speller texts/aca.txt When I run debug50, it is pointing to ...
0
votes
1answer
29 views

Pset5 load problem: Dictionary cannot be loaded

I run my code and it cannot load the dictionary. I'm not sure if the problem is with my code or the file location. Anybody knows why? Thanks in advance.
0
votes
1answer
96 views

Pset5 Speller returns all words misspelled and seg faults

I'm completely lost on this one. I can't see a problem with my check function but it never returns a match when using strcasecmp. I think the problem is probably in load() but I really have no idea ...
0
votes
0answers
37 views

Help on Pset5 Speller

bool load(const char *dictionary) { // Open dictionary FILE *dict = fopen(dictionary, "r"); if (dict == NULL) { printf("Could not read.\n"); return false; } ...
0
votes
1answer
83 views

pset5 - almost all words misspelled

I'm having trouble with the implementation of the PSET5 spell check code. I've looked through a lot of CS50 Stack Exchange posts, but haven't found any help. The problem is either in the check or in ...
0
votes
1answer
41 views

Help with speller load function on PSET4

I have been stuck on pset4 for quite some time without any meaningful progress. After re-watching the walkthroughs and reading answers here I've sort of put together a "frankenstein" thing for the ...
0
votes
1answer
76 views

pset5 speller-“Could not load dictionaries/large” even without “return false” in load

I typed in the command window './speller texts/cat.t' The window print out 'Could not load dictionaries/large.' I've made all the 'return false' in load comments. I don't understand why it can still ...
2
votes
2answers
88 views

2019 PSET4 SPELLER, I have no clue why it isn't working, I'm sure size and unload function is right, but unsure about load and check

// Implements a dictionary's functionality #include <ctype.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #...
0
votes
1answer
64 views

PSET 4 - Speller Load Function giving SEG Fault at strcpy(“cursor->word”, word);

while (fscanf(file, "%s", word) != EOF) { // TODO node *cursor = malloc(sizeof(node)); if(cursor == NULL) { unload(); return false; } strcpy("cursor->word",...
0
votes
0answers
38 views

Dictionary load in pset4 -> Trie Implementation

I don't know if this is a problem others have had? Having some issues with the dictionary load function in pset4. I decided to implement a trie and thru following debug50, I can see that it is ...
0
votes
1answer
37 views

Declaring a node (a struct pointer) from a function

I'm tackling load and decided to make a create_node function for allocating memory, NULLing all children and setting is_word as false. What I wrote is essentially the same as in this question struct ...
0
votes
1answer
92 views

CS50 Speller - Load, Use of undeclared identifier

I've been stuck on the load portion of Speller. Feels like I have a grasp on what I'm supposed to do but I keep getting use of undeclared identifier "head". Any guidance is appreciated. Am I headed in ...
0
votes
1answer
979 views

I keep getting the message that 'non-ASCII characters are not allowed outside of literals and identifiers.'

I keep getting the message that 'non-ASCII characters are not allowed outside of literals and identifiers.' I get this message when I compile and it is at the strcpy section. Any help gratefully ...
0
votes
0answers
46 views

PSET 4 - Speller The load function

I am implementing a trie and I can't figure out the load function. I can't understand how do I put the letters into the trie other than the first trie. So, far I have only figured out this much ...
0
votes
1answer
38 views

All words are returned misspelled

I'm running this program on a small dictionary and a small text sample. I think that loading the dictionary is working correctly. But how can I know for sure? When I implement the load and check ...
0
votes
1answer
210 views

How to “Insert into linked list for load function”? (pset4 - speller)

I'm currently trying to implement the load function in pset4 speller. The part that I'm having trouble understanding is "insert words into hash table linked lists." My current understanding on ...
0
votes
1answer
92 views

CS50 Speller seems to be stuck even after finding all the incorrect words

I've been completing the fourth problem set on the CS50 course. After checking multiple times for errors in my code I finally managed to make it compile. The program works as it finds all of the ...
0
votes
1answer
58 views

cs50 speller trie: (in c language) can't figure out what i'm doing wrong with load. Seems to work but seems non-existent in other functions

sorry if I am asking the question in a wrong way or my code is too messy I am knew here. My problem is that it looks like load works and the dictionary is loaded into the trie but check and unload ...
0
votes
1answer
46 views

Valgrind 1000000 errors

My code for loading the dictionary in tries is this: // Insert words into trie while (fscanf(file, "%s", word) != EOF) { node *next_node; // Iterate trought every letter of word for (int ...
0
votes
1answer
357 views

How can I debug my load() function in Speller?

So I have code that I feel as though should be working, but I'm having trouble checking my work. I wrote a function that I think loops through my table, but it only displays half of the data seemingly....
0
votes
1answer
47 views

Speller load() seemingly overwriting each word value

I think my load function is pretty close, but I cannot seem to get it to work properly, I built a function to read the data and I saw it's only storing one word in each bucket. Any ideas on what's ...
1
vote
1answer
113 views

pset4 - speller trie load - ptr not linking up

I have been stuck on the load part of the speller exercise for the tries table. I have gone through a lot of the existing questions and come to the following code: while (fscanf(file, "%s", word) != ...
0
votes
1answer
64 views

Pset5 load - Stuck in infinite nested while loop

I have been working on this problem set for some time. At the moment I am stuck at figuring out why the nested while loop is infinite despite of the fact that there is an fgetc() function that runs ...
0
votes
2answers
127 views

PSet5 Unload(): *** Error in `./speller': double free or corruption (top): 0x0000000002bcb610 *** Aborted

I have been trying to solve this problem for about 3 weeks now...after multiple iterations I just cannot seem to find what I am doing wrong in the load or unload functions to trigger this error. Below ...

1
2 3 4 5
8