Questions tagged [load]

the first part of pset5, loading a dictionary into memory

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

Pset5 Speller - Weird Load Function Bug (Edited w/ Code)

bool load(const char *dictionary) { // TODO FILE *fdict = fopen(dictionary, "r"); if (fdict == NULL) { return false; } // create container string to hold ...
Poptart's user avatar
0 votes
1 answer
51 views

Speller Segmentation Fault Even After Freeing Malloc'd Nodes

The following is my code and, subsequently, the message Valgrind returns when I run it on ./speller texts/lalaland.txt. I explored similar issues previously posted on Stack exchange, and added lines ...
Hamster1303's user avatar
0 votes
1 answer
32 views

Speller: memory leak

This is my program: // Implements a dictionary's functionality #include <ctype.h> #include <stdbool.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #...
shirin's user avatar
  • 1
0 votes
1 answer
20 views

Pset5 Speller - trying to understand more about segmentation fault

I tested a piece of code to figure out what's causing the segmentation fault with the 'load' function. The code below opens the large dictionary. Then it scans and prints each string inside the ...
Soumik's user avatar
  • 15
0 votes
1 answer
77 views

Pset 5 Speller fscanf returning 0

for Pset5 speller my code for load along with the generation of hash codes leads to a segmentation fault. I realized it is because fscanf returns 0 after the last word of the dictionary, leading to -...
duckpro's user avatar
0 votes
1 answer
29 views

PSET5 Speller seg fault

I keep having segmentation fault in Pset5 Speller. I used debugger to find the line where seg fault happens, and it was "table[k] = n;" in function load. I don't really understand. Could ...
Eva Chen's user avatar
0 votes
1 answer
39 views

segmentation fault from pointers

i keep getting segmentation fault when running this code. using printf i can see its from loading ala and the hashtable to store this is set to nil. other words when the hashtable to store them is nil ...
yosef's user avatar
  • 5
0 votes
1 answer
59 views

PSET5 - 3 conceptual questions (debug not needed)

Question 1 (hash) – is it even remotely possible to reverse engineer the hash function when given lots of output? For example if the underlying hash function is something simple like tolower(word[0]) %...
Vincent Xu's user avatar
0 votes
2 answers
31 views

Speller returning 'a' or 'A' as misspelled 500+ times

I successfully managed to make the code compile and removed all segmentation faults, but now it returns the problem as described in the title. I assume the problem is in load, as it appears to not be ...
ryanjbr's user avatar
0 votes
1 answer
64 views

Speller - Doesn't work properly

I can't seem to fix this code by myself. I'm sure the main issue is in the load function, but I've changed it many times and the best I could get is a few misspelled words. I haven't even changed the ...
Avanoc's user avatar
  • 3
0 votes
1 answer
65 views

Speller perfomance question

I've completed speller and passed all checks. But I'm still bugged about the performance. I did my best with research and running tests, but my implementation is slower by 10-20% compared to staff's ...
meotet's user avatar
  • 1
0 votes
1 answer
80 views

Pset5 Speller and the point of malloc

I'm having a really hard time understanding why we use malloc to get memory instead of just using the regular int n = 0; way. Typically when we want to make an int, we type int n; not int* n = malloc(...
H_R's user avatar
  • 101
0 votes
0 answers
69 views

Speller: Load function only reads 9 words to memory

I finished coding all functions for the pset5. However, all my tests result in the same output: Words in Dictionary: 9 It does not matter which texts I am running. But, I cannot find my fault in the ...
user avatar
0 votes
1 answer
23 views

Clang error when compiling (Pset 5)

I tried googling this but I couldn't find (or understand) much. I'm receiving the following error when I go to make dictionary: Here is my code for the load portion:
hawki2sl's user avatar
1 vote
1 answer
397 views

Pset5 speller load

I am having an issue with my load function in pset5 speller, I really can't tell what's going on. I've gone back and rewatched the lectures and have redone my code a few times but just can't figure it ...
Michael Puckett's user avatar
0 votes
1 answer
55 views

PSET5 Why Speller can't load dictionary? (included HASH function in case it's relevant)

// Load function bool load(const char *dictionary) { char word[LENGTH + 1]; FILE *file = fopen("dictionary", "r"); if (file == NULL) { printf(&...
General Noob's user avatar
0 votes
1 answer
26 views

pset4 CS50 IDE broken when opened card.raw

While I was working on pset4/recover I couldn't make it work as desired, so I wanted to check the first few bytes of card.raw manually. I double-clicked the file and now my cs50 IDE never loads and ...
nico_so's user avatar
0 votes
1 answer
59 views

Help with check function (PSET5)

My check function is counting the right amount of words in dictionary and text, but it outputs words that are not misspelled. Here are all the functions of the problem, the arrays are used to locate ...
Isabel García's user avatar
0 votes
1 answer
170 views

problems in unload function-pset5

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

Problem Set 5 - Segmentation Fault

I am trying to overcome the segmentation fault on the following code, and I couldn't manage to solve the error. Segmentation fault occurs in the load() function, and after hours of debugging, I couldn'...
DarthVader's user avatar
0 votes
1 answer
101 views

Speller skips first word in dictionary

After chasing down and eliminating memory leaks, I think I am getting close to finishing speller. So far, valgrind says no memory leaks, and the output is formatted correctly. However, when running my ...
Rachel D's user avatar
1 vote
1 answer
85 views

PSET 5 Load Function woes

Back with more questions about my code. 1) fscanf: When using fscanf do we need to iterate through what it is writing to the buffer to check for the null signifier so we can jump in and strcpy that ...
Multiplify's user avatar
0 votes
2 answers
182 views

PSET5 Speller Load function skips the words from the dictionary

Struggling with the load function in speller for second week now. What I found using debug50 and placing "printf" between different lines of code is that the fscanf reads every second word ...
Alexander Alexandrov's user avatar
0 votes
1 answer
34 views

Pset5 - Speller - Seg fault

I'm getting a segmentation fault when running this. Valgrind reports no errors, but a leak of 1,080 bytes at two blocks, with 5 allocs and only 3 free'd. Below is my load function and below that are ...
nicolasalouf's user avatar
0 votes
2 answers
265 views

Pset5 - Speller - Valgrind error for malloc in load function

I get all test results correct except the Valgrind error as follows, does anyone know why is it so and share some insights please? thanks! running valgrind --show-leak-kinds=all --xml=yes --xml-file=/...
unacorn's user avatar
  • 101
0 votes
1 answer
112 views

Pset 5 speller load function and word

I'm working on my load function to obtain the "word" from dictionary and I obtain one of the next message dictionary.c:59:28: error: use of undeclared identifier 'word'; did you mean 'load'? ...
Nicolas Solis's user avatar
0 votes
1 answer
118 views

PSET5/Speller - Valgrind error: conditional jump, relates to table[i] array, but I've already initialized that (or have I?)?

I posted something similar a couple of days ago but have made progress since then. Specifically I found a couple of posts answered by Cliff B indicating the problem users had was that they hadn't ...
cormacl's user avatar
  • 48
0 votes
2 answers
65 views

Segmentation Fault on Speller's Load function

bool load(const char *dictionary) { FILE *dict = fopen(dictionary, "r"); if (dict == NULL) { return false; } char word[LENGTH + 1]; while (fscanf(dict, "%s&...
exdeval's user avatar
0 votes
1 answer
55 views

Pset5 Speller Valgrind error trouble

Baby programmer over here. Before moving on to the (check) function, I wanted to make sure the (load) function was correct. After performing Valgrind, I received the following errors. Up to this point,...
Valerie Bryant's user avatar
0 votes
1 answer
56 views

Word array sometimes filled with weird values - Speller

My code looks like this: (ignore the comments; they're old) // Implements a dictionary's functionality #include <stdbool.h> #include <string.h> #include "dictionary.h" #include &...
dillon__nguyen's user avatar
0 votes
1 answer
56 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 ...
Lisa's user avatar
  • 5
0 votes
0 answers
28 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 ...
David's user avatar
  • 1
0 votes
0 answers
22 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 ...
Devin Atalay's user avatar
0 votes
1 answer
34 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 ...
aidan's user avatar
  • 1
0 votes
1 answer
78 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:...
santiago correa's user avatar
0 votes
1 answer
135 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 ...
abbanator's user avatar
0 votes
0 answers
55 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) { ...
ayeeitsalpha's user avatar
0 votes
1 answer
251 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 ...
patrick sandoval's user avatar
0 votes
1 answer
114 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 :) ...
Olga Melnikova's user avatar
0 votes
3 answers
449 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 ...
ayeeitsalpha's user avatar
0 votes
1 answer
61 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 ...
Thomaslusignan's user avatar
0 votes
2 answers
274 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, "%...
person the human's user avatar
0 votes
1 answer
153 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== ...
lmcc's user avatar
  • 7
0 votes
1 answer
47 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 ...
lmcc's user avatar
  • 7
0 votes
1 answer
61 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 ...
HackeR73's user avatar
0 votes
1 answer
39 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. ...
Aladin Oliver Yu's user avatar
0 votes
1 answer
546 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 ...
tangolin's user avatar
  • 104
0 votes
2 answers
45 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 ...
sadprogrammer's user avatar
0 votes
1 answer
70 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) { // ...
Imperator10111's user avatar
0 votes
2 answers
69 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> #...
richa sharma's user avatar

1
2 3 4 5
9