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
656 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
266 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
238 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
461 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
287 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
371 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
167 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
34 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
34 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
49 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
123 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
377 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
79 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
329 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