Questions tagged [pset5]

The problem set for Week 5 will challenge you to apply what you've learned about pointers, memory management, file i/o and structs, creating more complex data structures (such as Hash Tables or Tries) and leveraging their power to write a lightning-fast spell check algorithm.

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

Speller Dictionary: Problem with Pointers

I am a bit confused by all the new things about pointers. We can access a the value of a pointer by dereferencing it. For example, if you have char* str, you access the information that str is ...
0
votes
0answers
138 views

pset5. dictionary lost

In speller.c we call the function to load the dictionary into memory: bool loaded = load(dictionary); where the declaration of the function is: bool load(const char* dictionary); My load( ) ...
0
votes
1answer
206 views

Linked List not working contd. Valgrind Error

The program is supposed to read the words of a file to a linked list. I got the Linked list working but now I'm faced with another error. I'm getting a segmentation fault when using a very large file. ...
0
votes
2answers
111 views

About Spanish and PSET 4

I notice that CS50 is doing a really effort to make the course more accesible to everyone, and you can see this below the videos is a lot subtitles links in many languages. So, in PSET 4 there is a ...
0
votes
0answers
65 views

compiling errors

I'm dealing with pset5 (speller.c), and I chose trie to run the program. when I compiled it, it said: dictionary.c:25:1: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int] root ...
0
votes
0answers
330 views

Initially running speller using the staffs dictionary

When trying to run ./speller, I ran ./speller text to see it in action. I received the error: Could not load /home/cs50/pset5/dictionaries/large. I went to /home/cs50/pset5/dictionaries, and the ...
0
votes
2answers
278 views

mispellings load won't open file

It took me about a week to figure out that the files for what was formerly pset6 had been moved to the pset5 folder, and that's why my code couldn't open them. Now, however, it is still not opening. I ...
0
votes
0answers
105 views

pset5 picture problems: jpg recovery

I have two main problems with recover: Does not recover 049.jpg - Is this because my program is getting a freak EOF? check50 hates me - Although my program recovers 000.jpg through 048.jpg fine, ...
0
votes
0answers
97 views

Resize.c Lines are shifted

I have been trying to debug my code for days now with little success. The enlarged image seems shifted when I open it. The white pixels in the middle are skewed off center, though my file is the ...
0
votes
1answer
116 views

unable to use structs to compare with bytes stored in buffer

my recover program keeps coming up with error invalid operands to binary expression at the line where I check if(buffer[0] == pattern1 || buffer[0] == pattern2) I'm not sure why this error occurs ...
0
votes
1answer
660 views

Not sure why resize.c isn't working

resize.c compiles and runs, but produces an image with a lot of black space. A fresh set of eyes on my code is welcome to see where I have gone wrong. I assume it has to do with padding but I can't ...
0
votes
0answers
154 views

Unable to solve resize.c

Hello guys I am stuck at pset-5 resize.c problem. Here is what i have done: 1) For updating header, in width and height, ave multiplied them by n and for Image size, subtracted the padding of input ...
0
votes
0answers
149 views

All pictures recovered, Valgrind OK, but Check50 won´t accept the pictures

I was thrilled to see that all the pictures were recovered to the jpg-folder with the correct filenames, but shocked to see that my program was still running! I had to Ctrl + C to end it. I managed ...
0
votes
1answer
267 views

pset5 recover creates 50 corrupted images

I seem to have in issue writing data inside my loop, so that 50 JPGs are created with only 1 block of content each. I am checking for the beginning of a new JPG, and open a new output file inside that ...
0
votes
1answer
83 views

Do CS50x students need to take part in the contest in pset5?

After the Computer Science Investigation (CSI), there is a contest about taking pictures with CS50 staff. See the link: http://youtu.be/Y4vV61lbL3g?t=9m23s
0
votes
2answers
240 views

Seg fault in recover.c pset5

I don't know why it's showing seg fault. Could anyone please tell me what I've done wrong? #include<stdio.h> #include<stdint.h> #include<stdlib.h> typedef uint8_t BYTE; ...
0
votes
0answers
166 views

Resize vertically not working. Help!

Okay, my image is coming out a bit shifted and with two dark spots. please help me pinpoint whats going wrong // iterate over infile's scanlines for (int i = 0, biHeight = abs(bi_o.biHeight); i &...
0
votes
1answer
477 views

Error: double free or corruption when running recover

After a very long time, I finally managed to find out why my version of recover.c only managed to recover 1 image (recover.c only recovers 1 image) Anyway, now I face a new problem. What I've ...
0
votes
1answer
288 views

Why i get wrong horizontal resize

I\m really stuck in the formula for horizontal resize.For my new padding if i enter 4 for (n) i get for my new padding answer 1, is that correct? fpos_t startline; for (int a = 0, biHeight = ...
0
votes
1answer
373 views

Recover pset5 scope?

I'm almost there, but one more question about recover.. In my code, I open a file inside an if condition, but how do I acces that file later? It's getting out of scope and I'm getting use of ...
0
votes
1answer
556 views

Rewrite method in resize.c

I am currently trying to conceptualize the idea of creating the vertical nth copy for resize.c but I don't grasp how the file position indicator can tell when there is a new line. How do I tell C to ...
0
votes
0answers
126 views

open file in binary mode, as opposed to text mode

On the http://www.cprogramming.com/tutorial/cfileio.html web page we can read <>. Well, an image file is actually not a text file. But in another stackexchange answer it is stated that a BMP file ...
0
votes
1answer
1k views

Updating header info in resize

I know I have to do this: //resize headers biWidth = biWidth * n biHeight = biHeight * n biSizeImage = (biHeight*3) * (biWidth*3) + padding bfSize = biSizeImage + 54 But I don't know ...
0
votes
1answer
476 views

PSET5: Trouble with CHECK50 and resize.c. Stuck with this problem [duplicate]

While submitting resize.c to check50 in pset5, I get the following results: check50 2014/x/pset5/resize bmp.h resize.c :) resize.c and bmp.h exist :) resize.c compiles :) doesn't resize 1x1-pixel ...
0
votes
1answer
59 views

Pset5 is missing from the web site

I just watched the Week 5 lecture and now I notice there is no pset5 accessible on the web site. Do I miss something here? I also notice that there is no Week 6 on the web site.
0
votes
1answer
168 views

pset5 resize file io fread

Among the recommended reading list for this pset was this page (http://www.cprogramming.com/tutorial/cfileio.html), which indicates that when using fopen specifically for reading or writing in binary, ...
0
votes
0answers
182 views

check50 fails my pset 5 resize.c even though output is identical to staff's implementation

I ran diff with the bmp file outputted by my resize program and the same bmp file outputted by the staff's implementation, and it says that the two files are identical; but check50 says it doesn't ...
0
votes
1answer
397 views

How does the “re-copy method” work?

So, in Zamyla's walkthrough, she says that for the "Re-Copy" method of vertical resizing, you have to go back to the start of the original row, and then repeat the horizontal resizing. I don't ...
0
votes
2answers
35 views

In PSET5/ Speller - Unload Valgrind says Conditional jump or move depends on uninitialised value(s)

So my code passes all the Check50 tests apart from the memory one. I have been playing around with this for ages, but don't understand what the problem is. Here's what valgrind says. And here's the ...
0
votes
1answer
35 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,...
0
votes
1answer
92 views

Getting a segmentation fault when i try to run pset5 speller and i'm not sure what's the problem. Appreciate it if someone can explain. thanks!

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

load function pset5; segmentation fault tackled?

This is the code for my load function bool load(const char *dictionary) { //open dictionary FILE *inptr = fopen(dictionary, "r"); if (inptr == NULL) { fprintf(stderr, "Could not open %s.\n", ...
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
1k views

Valgrind still reachable memory

For my pset5 speller program valgrind is saying that i have still reachable memory. This is the output: HEAP SUMMARY: ==24516== in use at exit: 352 bytes in 1 blocks ==24516== total heap usage: ...
-1
votes
1answer
239 views

Pset5 speller.c

I had a few questions in speller.c that I didn't fully understand. First, why does it include #undef getrusage if it never redefines it? Maybe i'm not fully understanding undef. And also. for: /...
-1
votes
1answer
378 views

Recover Never Stops

I've been slowly moving through recover, and have figured out how to recover all 50 images. Unfortunately, the program never stops running (I hit ctrl + c to stop it) and the 50th image, while ...
-1
votes
1answer
335 views

Problem with resize

I'm with the pset5 and my code doesn't work and I don't know why. Can somebody help me? Here is my code: //resize headers BITMAPFILEHEADER bfNew; BITMAPINFOHEADER biNew; biNew.biWidth = bi.biWidth * ...
-1
votes
1answer
81 views

pset5/dictionary.c help me to remove the bugs on this code

// Implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> #include "dictionary.h" //...
-1
votes
1answer
132 views

Recover creates 16 corrupt images

Not Sure why my program is not making valid Jpegs! I am almost done!! Anyways, here is my code. I suspect it has something to do with the first write from buffer (the ones that detect jpeg file). #...
-1
votes
1answer
160 views

resizing problem

check50 shows that i cant resize 1x1px image by 2 and 3, others are fine and i don't know why....can anyone give me some hints. thanks. My headers are fine as i checked... // read infile's ...
-1
votes
1answer
170 views

How to read the next sector in recover?

Below is the code that i have written when i execute the code i get jpg images but they are corrupted.Any help regarding it? //reading the sector and checking the condition do { fread(from ...
-1
votes
3answers
330 views

Why Doesn't check50 Recognize My Recovered Images?

when I use check50 to check my recover program for pset 5, it says that the pictures are not recovered, but when I look in the file directory, all of the 50 pictures are perfectly recovered. How could ...

1
20 21 22 23
24