Questions tagged [pset4]

The standard edition of Problem Set 4 will move beyond C programming language basics, testing your knowledge of pointers, memory management, file i/o and structs.

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

Pset4 Recover Creating Segmentation Fault

Trying to work through Pset4 Recover. Currently getting a segmentation fault and not opening any new jpegs. My logic thinking here was to: Make sure user submits just 1 command line argument Open ...
0
votes
1answer
33 views

Pset4 Recover Segmentation Error. Valgrind unable to find anything

I'm sorry to bring about yet another segmentation fault but I cannot for the life in me find the error (Even valgrind is kinda malfunctioning). Here's my code- #include <stdio.h> #include <...
0
votes
1answer
26 views

Filter(less) Blur is all but correct for 1 or 2 values

I've been looking through the similar questions and they don't really help me. I clicked the link to see the results and double checked my code but it just doesn't seem to want to work. Here's my code:...
0
votes
1answer
35 views

pset4 recover: Not getting as many files as the problem requires

After reading a few submissions for help here and in the subreddit, People have told me there should be 50 files in the memory card. I have made a loop that correctly reads the file, but as soon as I ...
0
votes
1answer
72 views

Two problems with pset4 in Grayscale and Sepia

The following code keeps on giving me bugs about something I can't figure out when checking with check50 and I'm not sure what's wrong. here's the code: // Convert image to grayscale void grayscale(...
0
votes
1answer
66 views

Pset4 Recovery Produces Corrupt Null Files & Skips An Image

I've been working at recovery for a while - I believe I'm nearly done with it - but right now my code is giving me serious problems. Currently, running ./recover card.raw produces 49 of the 50 images (...
0
votes
1answer
40 views

CS50 pset 4 Recovery timed out even though everything compiles

There seems to be an infinite loop in my program that I'm unable to find, could someone please help me Here's my code #include <stdio.h> #include <stdlib.h> #include <cs50.h> #...
0
votes
1answer
43 views

pset4-recover: can get 50 photos but a column on the left appears on the right, problems of colors and on the first portion of the photo

I've tried some different values with fread() an with fwrite() but had no new results. On the right in some pictures appears, like a column, part of the image that should be at the left, and in some ...
0
votes
1answer
70 views

CS50 PSet4 Recover fails Check50

I'm having trouble finding the issue with my code. It successfully recovers 50 JPEG files 000 - 049 which can all be opened and viewed and seem correct. But my code fails check50. Does anybody have ...
0
votes
2answers
62 views

Wanting to understand PSET4 Recover Else if statement

I have a question regarding a else if statement for the PSET4 Recover while (fread(buffer, 512, 1, card_raw)) { if (buffer[0] == 0xff && buffer[1] == 0xd8 && buffer[2] == 0xff &...
0
votes
1answer
46 views

Week 4 - Recovery - Expected Exit Codes

I've run check50 and I get the following error message. :) recover.c exists. :) recover.c compiles. :) handles lack of forensic image :( recovers 000.jpg correctly expected exit code 0, not 1 :( ...
0
votes
1answer
53 views

pset 4 - recover. Can't figure out what is going wrong!

Can't figure out what I'm doing wrong, I've spent like 2 days on it already, please help! #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { if (argc != 2) {...
0
votes
1answer
40 views

I'm working on CS50 Recover, but my images aren't showing up and I can't figure out why

#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { if (argc != 2) { printf("Usage: ./recover image\n"); return 1; } ...
0
votes
1answer
58 views

pset4 Recover - seems to recover images correctly but fails check50

Working on pset4 - recover. The program compiles and runs and upon opening the images, they look alright. Check50 returns: :) recovers 000.jpg correctly :( recovers middle images correctly ...
0
votes
1answer
46 views

CS50 Pset4 Logic Problem

I am 3 days into PSET 4 Recover. In PSET 4 we are supposed to create a program which inputs a memory card and scans through that memory card for the signatures of lost JPEG files. Once the header of a ...
0
votes
1answer
31 views

Recover (segmentation fault)

I keep getting segmentation fault on my code. I can't quite pinpoint where the problem lies, but it's most likely within my while loop. Would appreciate if someone can give me a hint or point where ...
0
votes
1answer
79 views

Need help with pset4 filter blur

Getting close on pset4 filter (less) but getting hung up with the following errors for the blur function. Anyone able to see what I am doing wrong? Would welcome any advice. Here are the errors I am ...
0
votes
1answer
44 views

Pset 4 Recover Issue

I am 2 days into PSET 4 Recover. I can get the program to compile successfully without errors but my program is not returning any JPEGs, with no errors to point me in any direction as to what might be ...
0
votes
1answer
62 views

CS50 Pset4 Blur

Greatings fellow Humans So I am about at my wit's end with this one. I have set it all out and have the maths (I beleive) correct on the averages. BUT... check 50 says that some of the averages are ...
0
votes
1answer
69 views

My helpers doesn't pass check50

my helpers doesn't pass check50 and I don't know why. This is the code: #include "helpers.h" #include <math.h> // Convert image to grayscale void grayscale(int height, int width, ...
0
votes
1answer
44 views

pset4 - can't figure out what i'm doing wrong - recover

This is the code: #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { if (argc != 2) { return 1; } FILE *file = fopen(argv[1], "r&...
0
votes
1answer
51 views

Pset4 filter problem: blur problem Runtime Error

I'm working on a solution to Pset4 blur and have hit a roadblock. My aim is to create average RGB values from a 3x3 grid surrounding and including current pixel and change pixel in original image to ...
1
vote
1answer
28 views

pset 4 - recover, can't figure out mistake

I can't figure out what I'm doing wrong, please help! #include <cs50.h> #include <stdio.h> #include <stdlib.h> #define BUFFER_SIZE 512 int main(void) { // open memory ...
0
votes
1answer
31 views

Pset4 Blur filter, loop for searching surrounding pixels

I'm trying to write the part of the code where the surrounding pixels around the main pixel are searched in order to make the average and later replace the main value for the average value. I am ...
2
votes
1answer
69 views

pset4 - filter program,can't figure out what exactly is the problem with blur!

Can't figure out what the problem with this code is. It seems to be working correctly for corners, but for nothing else. Please help! void blur(int height, int width, RGBTRIPLE image[height][width]) { ...
1
vote
1answer
29 views

Pset4 - Filter (more) Edge Detection Help

I'm testing my Gy function separately, and it looks like the values I put in the test array are not correctly showing up in the function. I printf() the main function and they are recording correctly, ...
0
votes
1answer
115 views

Pset4 Reflect Filter Challenges - Not Reflecting

I am working on reflecting this image. I think I got the logic correctly, but I am not positive about that. However, my image did not reflect. Is this because I need to use malloc? I tried to but ...
0
votes
1answer
54 views

cs50 pset4 blur function index out of bounds issue

I am working on the cs50 pset4 blur function, but I seem to be getting runtime error index out of bounds for the top and bottom pixels. Here is the code: // Blur image void blur(int height, int width, ...
1
vote
1answer
63 views

PSET4 Recover, cannot seem to find my mistake - Recovered image does not match

I've been struggling to finish PSET4 Recover. I have followed the walkthroughs and I feel like I have incorporated every step they explain, yet when running check50, it shows that all of the recovered ...
0
votes
1answer
57 views

Pset4 Recover Help Understanding What to Do

I am trying to work on Pset4 Recover. I am having trouble understanding exactly what to do. Any help explaning would be appreciated. I have started but I know it's not all right and I know it doesn't ...
0
votes
1answer
64 views

Pset 4 Blur Filter Program Seems to Compile but Doesn't Output Anything and Check50 Reads Errors

I am having trouble with the blur function. I am not given any error messages when I run the program, and it creates an output image as if the blurring is working. However, when I open the output ...
0
votes
1answer
105 views

pset4 filter/blur code problem

I have written code for the blur filter in problem set 4. The code compiles and runs fine and seems to blur the image but when I run check50 it says that the RGB values aren't correct. I have looked ...
0
votes
1answer
54 views

PSET 4 - Recover - Not getting any errors, but also not getting any output!

Long time lurker, first time poster. I'm working on Pset 4 - Recover. My code is below. My expected behaviour is that this should parse through the provided card.raw file and extract the JPEGs. ...
0
votes
1answer
43 views

I know that my recover is wrong, but I'm not sure what steps to take-

I 'm getting a segmentation fault for my recover code. I know that it's wrong, and I think that this boils down to me not really understanding how to apply pointers/file functions. Maybe you could ...
0
votes
1answer
110 views

Implicit declaration of function of a declared prototype PSET4

I have this error code: helpers.c:56:13: warning: implicit declaration of function 'swap' is invalid in C99 [-Wimplicit-function-declaration] swap(height, width, image, i, j); ^ helpers.c:62:6: error:...
1
vote
1answer
53 views

Pset4 Filter Less Blur Runtime Error

Below is my Blur function, which does actually work, yet still returns 9 runtime errors all relating to the right hand side of the image (or the width-value edge). I added a couple of printfs to check ...
0
votes
1answer
71 views

CS50 PSET4 (Less) Blur Failed 3x3 & 4x4

This code won't win any style contests, however comma all Check50 test pass except the 3x3 and 4x4. I made a copy of the image, blurred original values, and copied new values to the original image at ...
0
votes
1answer
19 views

Pset4: Recovery- Empty JPEG files

My code compiles fine and the syntax seems fine, but the 50 JPEG files it produces are all empty, except 001.jpg and 019.jpg which both show a small top portion of the image. Could someone kindly tell ...
0
votes
1answer
71 views

Help on blur function. Correct logic but wont work

So after I passed pset3, I thought things would go easier since my friend said that filter wasn't as complicated as Tideman. Now, I’m doing the blur filter part and stuck on its computation especially ...
0
votes
1answer
44 views

I can only find 13 images using recover

I am aware that the same question has been asked before: PSET4 Recover only finds 13/16 images However, as far as I could try given this answer, I could not fix my function so it would successfully ...
0
votes
1answer
113 views

Pset4 - recover - issue with file pointers

I'm working on recover and I think I'm nearly there but I can't resolve an issue with file pointers. When I'm compiling I'm getting two errors both say error: use of undeclared identifier 'ptr'. I ...
0
votes
1answer
44 views

Help on Pset4-recover, Segmentation Fault

Here is my code: #include <stdio.h> #include <stdlib.h> #include <stdint.h> //remember: free malloc + fclose files typedef uint8_t BYTE; int main(int argc, char *argv[]) { //...
0
votes
1answer
47 views

PSET4: filter(less) sepia limit to 8 bits

I'm working on pset4 filter(less) and have a question regarding limiting the RGB value to 8 bits. I'd like to know what happens when a value of more than 8 bits is stored in BYTE (uint8_t). Initially, ...
0
votes
1answer
25 views

Seg Fault in Writing to JPG

I am working on PSET4 Recover, and got to writing to the output file, but for some reason, it SegFaults when I try writing to a jpg. The error, as far as I can tell, occurs in the While Loop in the ...
0
votes
2answers
176 views

Can't seem to wrap my head around what the Bitwise AND operator does in Pset4 vs. && AND operator

I just watched the Recover video and I saw them mention bitwise arithmetic, but I am not exactly sure what that means nor what it does. I saw another forum post explain it but that also didn't really ...
0
votes
1answer
51 views

Runtime error in pset4

I'm currently working on filter.c, and I'm struggling with the blur segment of it. I tried to write a code (I'm aware it's a mess of hard-code, but it's an attempt!), but I keep getting this error: ...
0
votes
2answers
105 views

Pset4 Recover: succesfully recovers first and second image, unsure as to why no other image is recovered (spoiler)

I must admit I'm having particular trouble in this assignment. Maybe it's the amount of new concepts. I think I have the idea down but I must me missing an error regarding the loop. I've tried ...
0
votes
1answer
36 views

pset4 recover - how can I get last few bytes to JPG

I've finally gotten recover.c to the point where it compiles. When I run it, it gives me this error message: munmap_chunk(): invalid pointer Aborted But it also generates all fifty of the pictures! ...
0
votes
1answer
113 views

pset4 Filter (more) Edge Detection help

void edges(int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE copy[height][width]; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) {...
0
votes
1answer
39 views

Pset4: filter greyscale UndefinedBehaviorSanitizer (not due to incorrect order of height and width)

I've seen all the other questions and answers regarding this specific error. Thankfully, or not so, my error was not due to the order in which I looped through the image. Here's my code: void ...

1 2 3
4
5
35