Questions tagged [load]

the first part of pset5, loading a dictionary into memory

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

Pset5 - Implementing Load function - Help with calloc

I'm not sure I am using calloc correctly as it is my first time attempting after getting random seg faults using malloc. Anyway, after changing my code to use calloc instead of malloc, I am still ...
0
votes
1answer
55 views

Pset5 Load - Getting Seg Fault when setting is_word = true

bool load(const char* dictionary) { FILE* infile = fopen(dictionary, "r"); if (infile == NULL) { return false; fclose(infile); } node* root = malloc(sizeof(node)); node* new_node = root; if(...
0
votes
1answer
103 views

Trouble with Substrings in Check in Pset5

I have used a trie structure to implement my dictionary in pset5 and I believe my load() function is operating correctly, however I seem to be having trouble with checking substrings in the check() ...
0
votes
1answer
315 views

pset6 load - why does fseek(file, 0, SEEK_END); size = ftell(file); not work?

after some struggles I just finished pset6. In particular my load function caused quite some pain. I thought I'd be spart and instead of reading the file in chunks of 512 bytes and doing a lot of ...
1
vote
1answer
101 views

Pset6: Errors with Check50

When I use check50 to check my parse function, I find that check50 fails multiple tests and that the terminal generates multiple errors. I am using strtok to separate the request line into different ...
0
votes
1answer
60 views

Pset5 problem with load function : Keeps getting segmentation fault

I have been working on pset5 and i keep getting segmentation fault while trying to implement 'load' function. I cannot really see where is the problem. Any help will be really appreciated! Here's my ...
0
votes
1answer
80 views

PSET5 - Why am i getting segmentation fault after correctly finding some mispelled words?

After i finished the code for load() and check(), I ran speller to find out if it was running correctly. Unfortunately, after finding some mispelled words, I get a segmentation fault message. Can ...
0
votes
1answer
26 views

pset6:html page cannot return name correctly

I have struggled with the server.c for half a month. Now everything seems OK except for the html page.When I firstly type in the name, it shows correctly. But the second time,I type in another name-...
0
votes
1answer
82 views

Need help with load function pset6

Just after completing Parse i've stucked on load function. By cs50 check i definately understand that something is wrong in reading memory to a buffer and maybe even accsessing it. For my eyes this ...
0
votes
1answer
68 views

PSET6 Load - How To Approach? Also, Is It Better To Use While() Loop or For() Loop?

I watched the walkthrough for load, but I am struggling to understand what the problem set is asking for. What is load's objective, and what is the best way to approach load? I also don't know ...
0
votes
1answer
72 views

Load and server not working, am confused

Am really trying to solve server.c though I don't really understand the specification for load and indexes functions. My parse and lookup seems to be working well, they passed check50 for server1 ...
0
votes
1answer
58 views

Pset6: load() and indexes() fail check50 server2 (but parse() and lookup() pass check50 server1)

Have been going around in circles for days over Pset6. Pretty confident my lookup and parse functions are correct (and they pass check50 server1), but it's all gone very wrong with load and indexes. ...
0
votes
1answer
123 views

realloc and length in load(), server.c

I need help with load() in server.c. This is a follow-up to the other question, except now I'll post the updated code and make it a bit more specific. When I tested the server after implemented ...
0
votes
0answers
34 views

load() in pset6 [duplicate]

I need help understanding how to do load. I'm not asking to just be given the answer, mind you, just some pointers and hints. This is what I have so far: bool load(FILE* file, BYTE** content, ...
0
votes
1answer
52 views

help with load function

My load function loads everything except for cat.jpg and favicon.ico, cat.html will display cat.jpg though. I am unsure how to test or even begin fixing this. If anyone has any tips on how to debug or ...
0
votes
2answers
82 views

check function returns all mispelled in terminal

Well done all in CS50. My pset5 check function keeps listing all words as mispelled. I am using ./speller ~cs50/pset5/texts/austinpowers.txt to test run it. Please point me to where my oversight is. ...
0
votes
2answers
367 views

valgrind check have error;segmentation fault when run speller

Below is the message returned from valgrind check. ==6239== Invalid write of size 8 ==6239== at 0x401308: load (dictionary.c:109) ==6239== by 0x4009BD: main (speller.c:45) ==6239== Address ...
0
votes
1answer
297 views

pset5 load with a trie Killed

I'm having a lot of trouble with my pset5. I'm attempting to use a trie to load the dictionary. It will compile but nothing really more than that. when using gdb, the program shows "Killed" in the ...
0
votes
1answer
91 views

Logic Error in speller.c - Can't open text file and also have doubts about load() and check()

I wrote check() and then I tried to test speller with dictionary/small and a text file I'd written myself, but the text file couldn't be opened. Is there a problem with the way I implemented load() ...
0
votes
0answers
226 views

Pset5 speller.c valgrind errors in load and check

I have problem with speller.c. Check50 shows that everything is good but when I run valgrind there are a lot of errors. There are no memory leaks, but number of errors is huge. I ve already search for ...
0
votes
1answer
55 views

pset6 server2 load() fseek() return -1 [SOLVED]

I'm almost done with this one. However I have one more bug that I can't resolve. fseek is returning -1 only for some cases. errno's value is 29 after ftell, if that helps. check50 says: $ check50 ...
0
votes
1answer
41 views

pset5 compile but it's thinking too long so it must be wrong

I've moved ahead from my segfault in load (i think) (see previous post here) But now my code seems to run an infinite loop which am pretty sure still originated from the load (as debug50 does not ...
0
votes
1answer
82 views

Pset5 compile but report segmentation fault inside load

HELP!! I'm finally able to make my code compile without error. I know it won't guarantee it'll work, but at least I can move to the next step. :-) When I run the code it gives me segmentation fault in ...
0
votes
1answer
126 views

PSET5 - Loads 0 words into dictionary

my code compiles and runs, but loads 0 words into the dictionary. Can you spot what's wrong with it? (As a sample, I tried using the smaller dictionary with a random text file. example syntax: "./...
0
votes
1answer
245 views

Pset5 - Could not open dictionary

My command line syntax is "./speller dictionaries/small.txt test" If I could PM someone my full code, I'd really appreciate it. I'm getting the error "Could not open dictionary." First lines of my ...
0
votes
1answer
55 views

PSET 5 Words not loading in memory

I think there might be something wrong with the fscanf use because when using gbd temp's value never changes, it stays as NULL. Also, word's value stays as 0 throughout the entire program and every ...
0
votes
1answer
80 views

PSET6 - Double free error

I'm getting stuck in the last lines of PSET6. Apparently the problem is in the LOAD function. Check50 server2 getting all but 1 lines marked red :( and when running the program I get * Error in `./...
0
votes
1answer
64 views

Pset6: Everything but cat.jpg, problem with load

The check50 returns a success for every test except the cat.jpg and the cat.html/cat.jpg. After doing several debuggings I've determined that the issue is arising in the load function but I cannot ...
0
votes
1answer
71 views

pset6 server load - struggling with how to test this one

This pset has been a truly humbling experience. I was able to get lookup working (I think, based on my testing), and parse I could think of a general idea and then had to work through the specifics ...
2
votes
1answer
182 views

CS50 PSET5 Won't Work With Apostrophes

I was testing my program with different texts and I found out that my code lists all words with apostrophes as misspelled, even though I have an if statement in my load function that checks for any ...
1
vote
1answer
163 views

CS50 PSET5 - Segmentation Fault

When I was testing my code, I found that my code gives a segmentation fault using the large dictionary and is unable to load/open the small dictionary. Is this a result of my load function? Thanks in ...
0
votes
1answer
219 views

CS50 Pset5: Load - Permission Denied

I have been implementing my load function and I saw in the lecture that I should use valgrind to check for any possible leaks. However, when I use valgrind with my code, I get an error that says ...
0
votes
1answer
227 views

Capital letters and strcmp() issue in check function

First time posting a question but I have been struggling with this issue for about two weeks now. All words in the text file with capital letters are showing up as misspelled. I am also seeing an ...
0
votes
1answer
435 views

Pset 5 implement load with trie

can someone help me please figure out what am i doing wrong with imlementing the load function: 1.when i try to run the program i get a "killed" massage. 2. it looks like i have a leak of memo but i ...
1
vote
1answer
123 views

PSET5: problems with load?

So I'm not getting load to work properly in PSET5. Any tips on what I'm doing wrong? My method now: Scan char by char in file until EOF; increment index (global) Insert each item into the trie ...
1
vote
1answer
118 views

pset5 check function not working

I have tried to implement load/check function as best as I understand it. When I run it, it prints out all the words in the text as misspelled. I don't even know what is wrong with my code at all. ...
0
votes
1answer
509 views

pset6 - load(), realloc() and 'invalid next size' error

I am stucked at the load() function. This line : newBufferSize = bufferSize * (*length); gives me the following error: realloc(): invalid next size: 0x0000000000607be Then the process was aborted. ...
1
vote
1answer
397 views

Help with PSet 5 Load Function

I hope you are well. I am currently on pset 5 where you have to write a spell checker. I am stuck on the load function. I am able to get stuff into my linked list. when I make and run it, I get a ...
0
votes
1answer
167 views

Pset6: How to debug load() and indexes()?

Every time comes the debugging part with the GDB, I feel quite lost. To a novice like me, GDB is not so handy compared with debuggers in IDEs of other languages and the graphic debugger is not working....
0
votes
1answer
120 views

Pset6: load() and indexes(), not standard errors

My first two functions passed the check50, but the last two report not standard errors. Am I on the right track? Could anyone give me some hints? Thank you! load() bool load(FILE* file, BYTE** ...
0
votes
1answer
710 views

PSET 5: Dictionary.c, Trie structure, Check/Load, All words misspelled

I know there are some similar questions, but I can't figure this out. I have checked my check program by running printf functions through it, and it does iterate through all the letters properly (for ...
0
votes
1answer
127 views

CS50 pset 6 server - I think something's wrong with my load function

EDIT: Fixed some more stuff, but remain stuck. Will continue troubleshooting, but would still appreciate input :) New code here: http://pastebin.com/gQyqPx99 Hello! I'm really stuck on pset6 server, ...
1
vote
1answer
91 views

Pset6 load returns length zero for php files

First time posting so if I'm off the mark here let me know. Basically, in writing server.c I can't figure out how to test my load function now that I've written it. check50 will only work once I've ...
0
votes
2answers
119 views

PSET5 Load: Memory allocation while passing / storing strings in Hash Function

Working on speller and have to stop, but would like some help on where I'm stuck. So far, have decided to go with a hash table approach. Assume: 1) I've already created a 2d massive array to store ...
0
votes
1answer
79 views

Load function doesn't work

I have a load function which seems not to work properly. I am checking the result of fread and it is not returning anything (int remains 0). May you please advise in which way should I dig to make it ...
0
votes
1answer
86 views

pset5 speller problem

so I am having problems implementing speller, particulary load function. I could find that immediately after I open a dictionary is sets file poiter to NULL, and I don`t know why. Really hope for your ...
0
votes
1answer
42 views

load() loads all files except php, fails nearly all tests in check50

Not using memset causes files to load improperly, yet I feel it is unnecessary. I am using fread, reading 1 byte before reallocating to a += 1 size, earlier I loaded 2048 bytes at a time and doubled ...
0
votes
2answers
141 views

Pset 6 - load - Help!

I don't think I've ever been so frustrated with a pset so far. I sort of understand what I have to do, but I can't just write proper code that'll make it happen. I don't think I've learnt pointers ...
0
votes
1answer
56 views

Server1 passes server 2 fails hard, not sure where to go from here

After debugging many times, watching every variable I could think of that would be used, I'm feeling stuck and I'm reaching out for some guidance. Server1 passes all tests https://sandbox.cs50.net/...
0
votes
1answer
60 views

pset6 load and indexes

So this is how may load bool load(FILE* file, BYTE** content, size_t* length) { if(file == NULL) return false; unsigned int size = 0; while(fgetc(file) != EOF) { size++; } *length = size; rewind(...

1 2 3
4
5
8