Questions tagged [load]

the first part of pset5, loading a dictionary into memory

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

STUCK ON LOAD FUNCTION SPELLER.C/PSET5

I am stuck on load function does compile but doesn't load the dictionary.Any suggestions will be appreciated!
0
votes
1answer
158 views

Problem in load function

Why does the code in the wile loop inside the load function only get executed once? /** * Implements a dictionary's functionality. */ #include <stdbool.h> #include <stdio.h> #include &...
0
votes
1answer
230 views

pset5 speller unload (trie) leaking memory

My unload function is leaking memory. Valgrind says that 8,960 bytes in 40 blocks were definitely lost, and 38,752 bytes in 173 blocks were indirectly lost. I'm not sure why...my unload function makes ...
0
votes
2answers
603 views

Pset5 - Speller - Load (loading only 1 word in dictionary)

I'm still trying to cope up with Pset5 So what I have: program shows 14 from 17 words in text as misspelled and is ended with *** Error in `./speller': free(): corrupted unsorted chunks: ...
0
votes
1answer
983 views

Pset5 - Speller - Load - Could not open dictionary

I've got problems with my "load" part. Have no idea where to move. Program says: Could not open dictionary. Could not load dictionaries/large. Also I did "check" part, but could not be sure is it ...
0
votes
2answers
99 views

Size of large dictionary trie structure seems very large

My speller seems to be working a-okay, but the dictionary load time is about 0.08 seconds slower than the staff implementation, and i wondered if that had something to do with an overlarge trie ...
0
votes
1answer
43 views

Pset5 Speller constantly giving seg fault

My implementation of load and check keep giving a seg fault when speller is executed. I've looked through questions with a similar problem, and I've tried everything - I've made sure that head is not ...
0
votes
1answer
88 views

Pset5 load function doesn't load any words

Still getting segmentation fault and have updated code several times. Here is my most recent iteration and have also attached copy of valgrind report. /** * Loads dictionary into memory. Returns ...
0
votes
1answer
123 views

pset5 load function has “expression result unused” errors

I think this relates to my understanding (or lack of) of pointers. I have 3 errors for the following code -- this is just inside my while statement. Both root and current are defined as nodes and ...
0
votes
1answer
128 views

Clang error with compiling code

I am working on the load function of pset 5 speller. My code, however, displays an error message when compliling, that basically looks like this: (.text+0x20): undefined reference to `main' ...
0
votes
2answers
190 views

Pset5 speller - load clang error (linker command error) and multiple definition

I typed make speller and clang produces the output below. I'm really not sure how to resolve this. I thought that it might be saying that I defined the hash function twice but I don't think I have. ...
1
vote
1answer
37 views

segmentation fault in in load using trie pset5

Can someone tell me why I get segmentation fault? bool load(const char *dictionary) { FILE *fp = fopen(dictionary, "r"); if (fp == NULL) { return false; } char word[45]; while (fscanf(fp, "%s",...
0
votes
0answers
22 views

I cannot get the right output.I think the problem is with load fuction,create function inside it

bool load(const char *dictionary) { ptr2=(node*)malloc(sizeof(node)); if(ptr2==NULL){ printf("error\n"); return false; } /* allot space for hashtable*/ for(int i=0;i<26;...
0
votes
1answer
231 views

Pset 5 Speller Check/Load Entries in Hashtable All Have Same Memory Address

I'm working on speller and am having problems with my check function. I thought that my load function is working right, I'm not getting any errors or memory leaks. But, when I look in my hashtable ...
0
votes
1answer
341 views

PSET5 speller (load) - stuck on understanding it's logic

I'm stuck on this part of the problem for weeks, it's killing me. If someone could please, please at least point me in the right direction. I know I'm asking a general question but I seriously don't ...
0
votes
1answer
129 views

cs50 pset 5 SPELLER load help segmentation fault

Hi all I was wonder if anyone can give me some advice on fixing my segmentation fault? I'm not sure why it is giving me a segmentation fault could it be I malloced my char* word with too much memory? ...
0
votes
1answer
71 views

Only last word in dictionary is spell checked correctly

The load function is loading the dictionary correctly (to the best of my knowledge). I have confirmed this by stepping through it in the debugger and watching the values change in the trie in the ...
0
votes
1answer
442 views

Pset 5 “Could not load dictionaries/large.” “Could not load small.” Errors

I dont know what the problem with my code. It doesn't load any dictionaries. I tried to test whether it can open a dictionary provided as a parameter but returns could not load small. Any ...
0
votes
1answer
525 views

Pset5 Accessing 8 Byte Outside An Array

I'm working on pset5 right now and I've met this problem that has taken me hours yet no luck to crack. This is how I defined my struct, containing a next[] array of 27 elements. // define the trie ...
0
votes
1answer
60 views

cs50 pset5 load tries not enough memory

I think I need help with my load function in pset5. I want to use tries and it generaly works fine (for small dictionaries). Moreover it checks words correctly but still I'm doing something choribly ...
0
votes
1answer
79 views

PSET5 - dictionary works the same as staff solution, but fails check 50

When I test my dictionary manually with the large dictionary, there are no issues. I even get the correct mispelled words. But if I use check50 or even test with smaller dictionaries, it doesn't seem ...
1
vote
1answer
344 views

pset5:(speller) Check function does not correctly identify misspelled words

/** * Implements a dictionary's functionality. */ #include <stdbool.h> #include "dictionary.h" #include<string.h> #include <stdio.h> #include <stdlib.h> #include<ctype.h&...
0
votes
1answer
378 views

Pset5 dictionary.c load and check: returning all words as misspelled?

Hi guys i've been spending hours on pset5 and for some reason it's showing all words as misspelled, i've checked ppl asking similar question but still couldn't get an answer, any suggestions would be ...
0
votes
2answers
96 views

pset5. Can't trace memory leak

Load function (with a trie data structure) //DEBUG unsigned int allocs = 0; // define node and create root typedef struct node { bool is_word; struct node* children[27]; } node; node* root; ...
0
votes
1answer
211 views

#pset5 Getting SegFault while using fgets function. Help identifying the problem

pset5 Hi, there. I am getting SegFault when entering while loop and fgets function. Can somebody help? I need to what is going wrong in this piece of code. #include<stdio.h> int main(int argc, ...
0
votes
1answer
362 views

Pset 5 Load Function

I'm having trouble with my load function... I had it working previously, but after changing some stuff and dealing with the check, I ran into this issue and can't seem to figure it out... Every time ...
2
votes
1answer
785 views

How is staff solution so fast in load and unload?

I have implemented dictionary as a trie and it's working fine. Check50 okays it, so does valgrind. Now, comparing the running times, my check() is as fast as the staff solution, but load() and unload()...
0
votes
1answer
133 views

pset5 speller load, please let me know if this makes sense

I'm having a really hard time with pset5.. I think I 'vaguely' understand the flow from the walkthrough, but it's really difficult for me to implement it in code.. I tried to 'collage' every element ...
0
votes
1answer
81 views

pset 5 load() trie implementation not correctly handing '\n' or '\0' characters

I've searched extensively for someone with a similar problem in the forums, but I have yet to find an answer. I have implemented load() with a trie. With my implementation of load() in pset5 "...
0
votes
1answer
219 views

PSET5: memory leak

Mem. leaking. help. Only written load function but have the free function within load. Haven't fleshed out unload yet. Want to test that load works before fleshing out unload hence have included the ...
1
vote
1answer
1k views

PSET5 speller (load) - fscanf function error

When I used the fscanf function in the while loop i get the error; "use of undeclared identifier "word". Heres my while loop: while(fscanf(fpt, "%s", word)!= EOF) So first I declared my "word" ...
0
votes
1answer
626 views

Is this hash function valid?

I just wonder if this hash function is correct? I was thinking that the index cannot be above 26 as it would look for memory outside the array, and would probably cause a segmentation fault. Therefore ...
0
votes
1answer
79 views

Problems printing trie to check load in Pset5 - edited

I'm trying to complete Pset5 using a trie. So far, I've written the code for load() and it seems to work (at least, my counter variable for the number of words goes to 2 when I try to load ...
0
votes
1answer
278 views

Speller Load gives segmentation fault

I implemented a trie datastructure, but my load function always gives a segmentation fault. Where am I going wrong? Here is my declaration of the trie: typedef struct node { bool ...
0
votes
1answer
94 views

Pset5 all words are misspelled and Valgrind reports 15 errors

I can compile pset5 but when I run the program, it treats all words misspelled. Also, Valgrind reports 15 errors and help50 hints that I am trying to access 1 byte of memory that isn't mine. I have no ...
0
votes
3answers
381 views

pset5 - Load - Debug Error - “Process received SIGSEGV: Segmentation fault”

I commented out my check function so it must be something here in load. From what I've read I think the issue is dealing with pointers and fgetc. That or my first for loop is looping weird. granted I'...
0
votes
1answer
58 views

pset5 load function seg fault with 1 error from Valgrind

This is my first question here. I have been working on pset5 for weeks already but still tackling the load function. My code of dictionary.c file is as below. It can be compiled but it reported "...
0
votes
0answers
31 views

Need help with pset5 load of speller.c. Segmentation error [duplicate]

typedef struct node { char word[LENGTH+1]; struct node *next; }node; int *num; node *hashtable[26]; int hash(const char* word) { int n = tolower(word[0])-'a'; return n % 26; } bool load(...
0
votes
1answer
82 views

Load code pset5, speller.c. Segmentation error

bool load(const char *dictionary) { FILE *dic=fopen(dictionary, "r"); node *hashtable[26]; int num=0; char word[LENGTH+1]; while(fscanf(dic,"%s", word)!=EOF) { node *new_node=malloc(sizeof(node)...
0
votes
1answer
627 views

I'm frustrated with this 'load' code of pset5 speller.c

bool load(const char *dictionary) { FILE *dic=fopen(dictionary, "r"); node *hashtable[26]; int hash(char* key) { int n = tolower(key[0])-'a'; return n % 26; } int num=0; char *word; while(...
0
votes
2answers
95 views

Check function not working. Using a Hash Map to store the dictionary

I am trying to debug and understand which part of my code is causing check() not to work. It's possible that the code maybe more complicated than needed but I was going to refactor it once I had a ...
0
votes
2answers
54 views

Pset5 load function segmentation fault in middle of dictionary

I having trouble with load function. I am trying to load dictionary in simple linked list, but in middle of dictionary I get segmentation fault. Please help. bool load(const char *dictionary) { ...
0
votes
1answer
73 views

Pset6 - Segmentation Fault In Lookup

When I use check50 on my code, it finds that I have a segmentation fault in my code. When I try to use GDB, I receive an error HTTP Not Implemented. When I try to run server.c, the server immediately ...
0
votes
1answer
118 views

PSET5 All words misspelled (trie structure)

When I run debugger, this part "if (!next->children[m])" is almost always true even though I can see that they are not null in the gdb panel. I have not got to implement the last two functions yet. ...
0
votes
1answer
373 views

How can I optimize load in pset5

I'm trying to optimize my load function (after using gprof to profile speller), as it takes 99.6% time of my program. How can I do it? Here is dictionary.c: /* This function opens a dictionary file ...
0
votes
1answer
60 views

PSET6 - load function - 1 file is not loaded (the jpg)

PSET6 is a huge challenge. I have juste passed the first checked and I am trying to understand why my load function is not 100% correct. This is the feedback of the second check : ~/workspace/...
0
votes
1answer
61 views

Pset5: Load function causes segmentation fault on assigning node

Here is my code for the load function. This function causes immediate segmentation fault on if (hashtable[index] == NULL) { hashtable[index] -> next = new; } bool load(const ...
0
votes
0answers
126 views

pset5 load() and unload()

I need some help in spotting where is the problem in my load and unload functions and if the logic is correct. Also, whenever I execute valgrind and its telling me: definitely lost: 8,013,040 bytes in ...
0
votes
1answer
73 views

Two compact versions of my load function don't work, help

I've tried for about five days to finish the load function but now that I have two compact versions which don't work I don't have any idea what i am doing wrong. Code for the first load function: ...
0
votes
1answer
35 views

PSET6 Load - My web-browser downloads the file instead of displaying it

Is there something wrong with my load method? It seems fine and looks correct compared to code others have posted on Stack. What is happening is the main page displays correctly. When I navigate to ...

1 2
3
4 5
8