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.

330 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
1answer
174 views

Header Problem in Resize

There is some serious flaw in the header file code of my program since all the variables that was required to be modified is showing error while running the peek program (as shown in in the screenshot ...
1
vote
1answer
50 views

Week 4: Recover (invalid stdio handle)

As I'm sure you're aware, the goal of this assignment is to recover a number of deleted jpeg files from a provided memory card image. My code compiles and executes, but I'm receiving the error "...
1
vote
1answer
219 views

pset 4 filter edge not working

I am having issues with my implementation of edges. I decided to make a 'border' around the edges of the image made up of zeros (did this in a copyImage array). I get correct outputs for some of the ...
1
vote
1answer
539 views

pset 4 : filter - Could not open .bmp file

I have a trivial question. Starting the pset with freshly downloaded and unchanged code and trying to pass a file with ./filter -g yard.bmp out.bmp yields : Could not open yard.bmp. I wrote a simple ...
1
vote
2answers
2k views

Pset4 filter edges issue

I'm trying to figure why my code doesn't work for detecting edges. Even though it produces a result, it is too white. Any suggestions? // Detect edges void edges(int height, int width, RGBTRIPLE ...
1
vote
1answer
465 views

Looking for clarification on PSET4 Resize - “Rewrite” method

Can I request for some help on my resize.c pset? I'm trying to do the "rewrite" method as per the pset's walkthrough. The pseudocode is as follows: 1 for each row 2 for each pixel 3 write ...
1
vote
1answer
103 views

pset 4 - recover -> invalid pointer

i am trying to solve the recover issue. When I run my programm I get: * Error in `./recover': free(): invalid pointer: 0x0000000001da5200 * Aborted I don't know how to proceed. Can someone please ...
1
vote
1answer
1k views

strcmp always returns 0, even with different strings. Week4

Working through the CS50 pages, I decided to do this locally on my Linux Mint computer (gcc --version gets me: gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4). At the start, I did not realize that cs50.c ...
1
vote
0answers
55 views

cs50 submit not working for pset4

I am having problems uploading my pset4 for the last few days. I have seen that other people have had the same problem months back but browsing through the questions I have not found any solution or ...
1
vote
1answer
264 views

Pset 4 Resize: Code works on smiley.bmp but not small.bmp

I am working on resize for pset4 and I can't get my code to work. It resizes smiley.bmp just fine but when I try to run it with small.bmp it comes back all wrong. I can't figure out what I have done ...
1
vote
1answer
138 views

pset4 recover - 16 images recovered with Invalid or Unsupported Image Format

I'm really confused. I reviewed all similar problems, but did find my case. It seems like jpeg start bytes are detected, but wrong data inserts to the output file. Please advise! 24-Oct-2016: The ...
1
vote
1answer
539 views

Pset4, resize, fseek, vertical scaling

I think I've gotten the horizontal resizing to work, however, I just don't get what's wrong with my vertical resizing. I've seen similar questions to mine, and I'm pretty sure my problem (assuming ...
1
vote
0answers
240 views

sizeof BITMAPFILEHEADER

As I am working on pset4, I am a little bit curious of the size of BITMAPFILEHEADER and BITMAPINFOHEADER. So I implement printf to display the size of individual element within the BITMAPFILEHEADER. I ...
1
vote
0answers
995 views

pset4 how to enhance the colors in the background

How do I enhance the colors in the background. I've added white colors to the image, making it much more visible, but not sure whodunit. I am trying to enhance the sky blue in the image so that I can ...
1
vote
1answer
172 views

Segmentation Fault in pset4

I keep on getting a segmentation fault on the function below and have no idea why. I used GDB to find where the fault was occurring but couldn't figure out any more than that. // keep playing until ...
1
vote
1answer
110 views

what's the error in the below function

I tried to make my own function in pset4-breakout to move the paddle but when i run and take my mouse to the output window I always get segmentation fault. I have tried gdb also but still i'm not able ...
1
vote
0answers
46 views

Why redefining `bool` primitives in 'SPL' as a typedef (rather than using stdbool.h)?

While reading through files included in /spl library (Stanford Portable Code), downloaded with pset4.zip distro, I came across this definitions in cslib.h: /* * Type: bool * ---------- * This type ...
1
vote
0answers
106 views

Can't run pset4 files outside of appliance

I usually use Ubuntu instead of appliance for programming, cause I feel much more comfortable that way and Ubuntu is the OS I use everyday. For that reason, I have downloaded the C compiler and the ...
1
vote
2answers
90 views

Problem uploading pest

I have tried to upload the zip file with my pset4 code to the CS50 submit function several times. I can add the files, but when I hit the upload button, the file appears to upload (the bottom green ...
1
vote
3answers
1k views

Can't run the staff implementation

i can't run the staff implementation for any problem set, i always get the same error, it's always something like : bash: ~cs50/pset4/breakout: No such file or directory
0
votes
1answer
4 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
0answers
8 views

FILTER BLUR FAILS 2 CHECKS. I taking a first principle approach. I cannot see why not full marks. Any help to all checked

// Blur image void blur(int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE red_pixel[height][width]; RGBTRIPLE green_pixel[height][width]; RGBTRIPLE blue_pixel[height][width]; ...
0
votes
0answers
23 views

Trouble filtering center pixels in pset4 filter blur

I am SO close on reflect but am still getting a few final errors. My code for pixels on the edge and in the corners seems to work fine. However, there is an issue with my code on the center pixels and ...
0
votes
1answer
31 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
24 views

pset4: recover segmentation fault

The code compiles fine but when running ./recover i keep getting a seg fault. i tried valgrind but still can't seem to get what the problem is exactly. #include <stdio.h> #include <stdlib.h&...
0
votes
1answer
8 views

Find hex values inside a string in C?

I have a long string "given_string", and I'm trying to find hex values within that string. Here's a simplified example: /* Find a sub-string in a given string: */ char * given_string = &...
0
votes
2answers
18 views

CS50 pset4 filter reflect issue

i am missing something here...but not sure what... it doesn't work on normal images... check50 passes for 1X2 and 1X3 images but fails for 3x3 and 4x4 images (so i guess it is an issue of iterating ...
0
votes
0answers
20 views

How do I fix my code for PSET 4 blur?

What I tried to do was go to each pixel and see if any neighboring ones existed. If they did, I saved the neighboring pixel's colors. Then I ran a loop to add up all the values in that specific color ...
0
votes
1answer
36 views

Pset 4 filter - blur almost works but has a few errors and I just can't figure out why

I've tried changing everything I can think of, but I can't figure out why this isn't working. #include "helpers.h" #include <math.h> int cap (int x); RGBTRIPLE rowend (RGBTRIPLE x, ...
0
votes
0answers
20 views

Getting UndefinedBehaviorSanitizer on pset4 filter blur (less comfortable)

I've tried doing this problem a few ways (without success). This time, I wrote the following code: #include "helpers.h" #include <math.h> int cap (int x); RGBTRIPLE corner (RGBTRIPLE ...
0
votes
1answer
14 views

getting undefined behaviour sanitiser deadly signal error which crashes everything when trying t run greyscale filter on pset4!

The below image shows my code and all the errors that come when I run it. I have to exit the terminal and start again to do anything! I don't understand what is wrong with the code. I have looked ...
0
votes
0answers
24 views

For pset4/recover i keep getting an error despite the pictures recovering when i run the program

could someone please identify whats wrong with my code. im a beginner and completely lost.
0
votes
0answers
8 views

Issues with PSET4 Filter Edge Detection

I've been testing my edges code for ages now but I can't seem to figure out the problem. When I run the code on the sample images the images look like they have been processed properly but when I put ...
0
votes
1answer
17 views

i don't know what is wrong when i run the program the output is all zeros

void blur(int height, int width, RGBTRIPLE image[height][width]) { double red_sum ; double green_sum ; double blue_sum ; double counter; RGBTRIPLE new_image[height][width]; ...
0
votes
0answers
11 views

Why does the code output incorrect amounts?

The code is here: https://pastebin.com/gKnVmPFf I've checked that it's not because of neighboring cells, because I am translating them onto a different array. I can't seem to figure out want is wrong. ...
0
votes
1answer
18 views

pset4 recover only recovers 25 correct images

This is my code for recover. When I run the program, it gives me 25 successfully recovered photos. I don't know why it is only giving me half the required photos. I believe it might have something to ...
0
votes
0answers
21 views

CS50 PSET4. Edges detection algorithm does not filter correctly 3x3 image and 4x4 image

I am working on Problem Set 4 of CS50 and I have some issue with Edges detection algorithm (description of the PSET4 can be found here: https://cs50.harvard.edu/x/2020/psets/4/filter/more/). In ...
0
votes
1answer
50 views

PSET4, RECOVER: Segmentation Fault

I have been trying to solve RECOVER from PSET4 and I keep getting a segmentation fault. Any ideas on why this happens? #include <stdio.h> #include <stdlib.h> #include <stdint.h> ...
0
votes
1answer
21 views

recover compiles but has segmentation fault when running it with ./recover card.raw, could anyone take a look

#include <stdio.h> #include <stdlib.h> #include <cs50.h> int main(int argc, char *argv[]) { //this counter to keep track of how many jpegs found so far int counter = 0; //allocate a ...
0
votes
0answers
23 views

Segfault error, please help

I really need help, I'm getting a segfault error. Please look through my code and help me, please. #include <stdio.h> #include <stdlib.h> #include <stdint.h> int main(int argc, char ...
0
votes
0answers
11 views

The image updates, yet incorrectly

Here is the link to the full code: https://pastebin.com/kFgWhfTR . The image is calculating incorrectly. I have no idea why. I know that it is not caused by one pixel updating the others.
0
votes
0answers
22 views

PSET4:Blur filter doesn't function

I have this code: // Blur image void blur(int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE tempImage[height][width]; int sumR = 0; int sumG = 0; int sumB = 0; ...
0
votes
1answer
57 views

pset4 filters: thinking behind blur

Need some help with blur. I think i'm getting it entirely wrong but i can't seem to understand why. None of the blur assessment are correct at all. Wonder if anyone can give me any tips on getting the ...
0
votes
1answer
17 views

PSET4 Sepia If Statements

Hi can i ask why the if statements does not execute in this code? I tried running the program and saw that the if statements were not executed. void sepia(int height, int width, RGBTRIPLE image[...
0
votes
0answers
23 views

Pset4 Filter (more) compiles but fails almost all of check50 :(

Check50 link & code below All compiles but just can't get check50 right, I feel like there must be a common mistake between all of the functions as they all seem to get the first 3 lines of pixels ...
0
votes
0answers
27 views

PSET4 Blur Filter, blurs images correctly but check50 fails all blur checks

Not sure what I am doing wrong, I tried casting double to the blurhelper function and check50 still says it is wrong. void blur(int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE(*...
0
votes
1answer
27 views

What is wrong with my filter blur?

Been stuck on the blurring part for ages... I've ran out of ideas and motivation to debug at this point after spending an eternity cutting down my spaghetti codes to pappardelle. Any help/hint/...
0
votes
0answers
22 views

PSET4 - Filter (Less) Blur - Keep getting :( blur correctly filters middle pixel expected “127 140 149\n”, not “118 131 140\n”

void blur(int height, int width, RGBTRIPLE image[height][width]) { //A box blur //take the average of the surrounding pixels (1 row and 1 column away) //Store all the surrounding and find ...
0
votes
0answers
27 views

CS50 Pset4 Filter Blur less comfortable

I've tried getting blur done for some time now and I just can't get the border pixels to calculate properly as they continue to go out of bounds. I have noticed that at the start of the program ...
0
votes
0answers
17 views

The blur is not updating when it should be

The suspected incorrect of my code is here: for(int i =0;i<height;i++) { for(int j = 0;j<width;j++) { image[i][j] = copy[i][j]; } } or ...

1
2 3 4 5
7