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
12 views

My blur function blurs every image, but fails every check50 check - please help!

I'd really appreciate any help that can be offered here. My code seems to output a blurred image perfectly, but fails every check50 check and I can't work out why... void blur(int height, int width, ...
0
votes
1answer
20 views

pset4 - Recover passed check50, but want to understand the logic on fwrite or file-pointer

Below are my code for pset4 - Recover, it passed the check50, but I am trying to understand the logic on a particular process of fwrite or file-pointer. In short, my question is how does line 74 know ...
0
votes
1answer
15 views

Pset 4 - Filter - Edge detection

My function kind of works but the result is too white. I saw some people having the same issue because they didn't store the new pixels in a temporary image, but I already did that. void edges(int ...
0
votes
1answer
17 views

PSET 4 - Recover produces an infinite loop

I have been working through this problem and cannot figure out why this while loop is producing an infinite loop and no image files, which is probably caused by a logic error on my part. As far as I ...
0
votes
0answers
16 views

pset4 - filter - less - blur doesn't work

// Blur image void blur(int height, int width, RGBTRIPLE image[height][width]) { //Temp array RGBTRIPLE temp[height][width]; for (int i = 0; i < height; i++) { for (int j = ...
0
votes
1answer
22 views

PS4 Recover Segmentation Fault (Core Dumped)

Hope you got into the new year well and healthy! I get a segmentation fault (core dumped) if I want to run ./recover card.raw Anyone got any tips because I have checked it 100 times already. Valgrind ...
0
votes
1answer
16 views

Pset4 Reflection Less Comfortable - Check50 Errors

Hello CS50 community, my question is about the reflection filter (less comfortable): I have compiled a code that is reflecting (YEAH!) but there seems to be the following errors when checking: *:) ...
0
votes
1answer
13 views

PSET4 - Recover - program timing out and not passing the check

could you please help me to understand why my program is not passing the check - the error says "timed out while program is trying to exit". It's compiling well, but seems to not even create ...
0
votes
1answer
15 views

CS50 Pset4 Sepia

I have been working on PSET4 and understood the code and the tasks fine. But my compilation does not change the image and I cannot figure out why it will not work for the life of me. I have checked ...
0
votes
1answer
17 views

PSET4 - Recover - Segmentation fault, not sure what's wrong

Can't understand what's wrong in my code: it's compiling but not creating jpgs, the check says "failed to execute program due to segmentation fault". Please help to understand - THANKS IN ...
0
votes
1answer
21 views

Regarding PSET4: Recover is compiled but only 26 files are recovered but unable to open images

#include <stdio.h> //call for sprintf() #include <stdint.h> //call for typedef uint8_t BYTE #include <stdlib.h> //call for sizeof() and NULL typedef uint8_t BYTE; //...
0
votes
1answer
13 views

PSet 4 Filter(less) Sepia - Why is my output image slightly red tinted?

At first, I forgot to cap the RGB values at 255 for sepia, and it resulted in white pixels being blue. But other areas were fine(proper sepia). So additionally, I added the ternary operators to check ...
0
votes
1answer
22 views

pset4 recover.c last image does not match

I've doing recover.c from pset4. When I ran check50, all images except for the last one. I guess it's probably the problem of feof function. But I don't know how to edit my code to make it works //...
0
votes
0answers
11 views

PSET 4 - Blur - IF Statement

I can't seem to understand why the if-statement doesn't work to filter out the cells outside of the image's rows/columns. see the full code below, I left out the part where I copy it back into the ...
0
votes
1answer
16 views

pset4 recover creates 50 images but bytes don't match up

My code creates the 50 files, all of them starting with the correct JPEG signature, however the rest of the bytes don't match up. In other words, first 4 bytes are correct, the following bytes are ...
0
votes
0answers
8 views

I keep getting the error: linker command failed with exit code 1 (use -v to see invocation) when I'm compiling my code for filter: blur in ide

I seem to get this error over and over again when i compile my code for filter: blur by typing "make helpers". I don't know if it's because of my code. This error did not appear when I ...
0
votes
1answer
34 views

My recover doesn't stop executing once it starts

Not actually sure what is wrong with my code but it doesn't end when it's executed. I tried adding return 0 so it would end but it's not working. code: #include <stdio.h> #include <stdlib.h&...
0
votes
1answer
20 views

PSET 4 Recover.C wrong exit code?

Currently getting the following errors when working on pset4 for the class CS50. Not sure why my exit code is none? Please let me know if you guys know what the issue is. Thank You. :) recover.c ...
0
votes
1answer
17 views

buffer array full of \000, pset 4 recover segfault

I am experienceing a problem where nothing is beign read into a buffer array, but for the life of me I am unable to figure out why. I have read through other threads with users experiencing the same ...
0
votes
1answer
12 views

Pset 4 filter blur function - only works with corner pixel

requesting help for my blur function. For each pixel, i have split it into 3 for loops. One calculating the row above, same row, and row below. In each loop , if the row is smaller than 0 or equal to ...
0
votes
1answer
25 views

How to conserve original values in blur function? (pset 4)

Here's my code inside the blur function (in pset 4, Filter-Less): int redSum; int greenSum; int blueSum; int n; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { ...
0
votes
1answer
34 views

Why does `size` = `0` occur?

I've been trying PSet4's Recover. I've been trying to obtain the size of the entered file (card.raw) but unfortunately size gives and output of 0. Here's the code that I've made to find the file's ...
0
votes
0answers
16 views

How do I interpret Valgrind to fix this program's segmentation fault?

I was attempting PSet 4's Recover but kept running into a segmentation fault. I tried using Valgrind to debug it but I have no idea of how to interpret the error message. My code: #include <stdio.h&...
0
votes
1answer
23 views

Some values in my 'edges' don't pass check50

the rightmost values in the matrix in check50 is wrong but the other values are correct. I'm not really sure what's wrong. code: void edges(int height, int width, RGBTRIPLE image[height][width]) { ...
0
votes
1answer
31 views

Pset4 recover getting Segmentation error

#include <stdio.h> #include <stdlib.h> #include <cs50.h> int main(int argc, char *argv[]) { // file opened FILE *file = fopen(argv[1], "r"); // user types two ...
0
votes
0answers
13 views

Help with PSet 4 Filter (More) Edge

I've been stuck on the Edge part of Filter (More) for a few days now. Check50 tells me that none of the pixels return the right values but I can't seem to find any problem with the code. Here's my ...
0
votes
1answer
16 views

Not getting the edge function to work

Please find my code for the edge function below, I'm getting all errors on check50 but can't understand what's wrong. // Detect edges void edges(int height, int width, RGBTRIPLE image[height][width]) {...
0
votes
1answer
43 views

Recover.c - Code Creates JPG files but it doesn't doesn't match expected output

#include <stdio.h> #include <stdint.h> #include <stdlib.h> typedef uint8_t BYTE; int main(int argc, char *argv[]) { //user didn't enter one argument or enters more than one if (argc &...
0
votes
1answer
35 views

Problem Set 4 Blur — incorrect output

I am currently working at the blur filter. While the other task were pretty easy, this one ist very much difficult. I have spend hours looking for the mistake - but without success, I tried to do it ...
0
votes
1answer
20 views

PSET4 filters helpers.c

I need some help with pointers, mostly. I've malloc'd a BUFFER pointer to the struct data type RGBTRIPLE. Though I can't access its properties. // Reflect image horizontally void reflect(int height, ...
0
votes
1answer
35 views

Need help solving blur with c

Code: void blur(int height, int width, RGBTRIPLE image[height][width]) { //temporary image to swap RGBTRIPLE temp_img[height][width]; for (int g = 0; g < height; g++) { for (int h = 0; h < ...
0
votes
0answers
24 views

check50 is not working with pset4 filter

I've been trying to check problemset4 filter-less but check50 is not working The username and password is correct and I have visited submit.cs50.io as the message says and I was logged in there but ...
0
votes
1answer
49 views

PSET 4 Recover.c - Segmentation fault

The code compiles perfectly. However, it triggers a segmentation fault which I imagine is due to a wrong use of pointers. This is the code: #include <stdio.h> #include <stdlib.h> #...
0
votes
0answers
16 views

CS50 Reflect Pset4 Runtime error

my code for reflect is this void swap (RGBTRIPLE *a, RGBTRIPLE *b) { RGBTRIPLE temp=*a; *a=*b; *b=temp; } // Reflect image horizontally void reflect(int height, int width, RGBTRIPLE image[height][...
0
votes
1answer
18 views

Why is reflect filter not working Pset4?

Here is my code. I have overcomplicated it. for (int i=0;i<height -1; i++) { for (int j=0;j<width- 1;j++) { int value[3]; value[0]=image[i][j].rgbtBlue; value[1]=image[i][j]....
0
votes
1answer
26 views

Images shifted with no 049.jpg in recover

My code compiles and runs and the images load and seem fine BUT it skips the first image and ends at 48. There IS an image named 000.jpg that is output but that image under the name 000.jpg from what ...
0
votes
2answers
26 views

edges completely fails check50

So I finished my edges function and it's failing everything for check50 and I can't understand what I did wrong. Any help would be greatly appreciated. Functions related to edges: // Sets new RGB ...
0
votes
2answers
35 views

Pset4, the first problem “Filter”. How can I define the grayscale function recursively?

I have a question about problem 4, assignment 1 Filter, where we have to define the grayscale function. So it is actually not difficult to define this function with a loop in a loop. But I am trying ...
0
votes
2answers
44 views

What's my error?

I am having some errors with my code in check50. All of my code is on this gist. Grayscale - expected "28 28 28\n", not "27 27 27\n" in without whole number average. I am using ...
0
votes
1answer
18 views

how can I rewind the fread() funtion as byte

is there a way to fread() the same bytes you just had read? fread(buffer, 512, 1, inptr); if (header(buffer) == true) { //execute these lines do { //execute these lines } ...
0
votes
1answer
35 views

Pset 4 Filter(less) Blur

I'm having an issue with the counter variable of my code. I wrote a printf to see if it returns 4, 6, or 9. Which is what it should do, if my IF conditions are correct. Unfortunately it does not ...
0
votes
1answer
45 views

CS50 Recover (pset4). Images dont seem to load

my program compiles successfully but it doesn't seem to produce any images at all. I tried using debug50 and it seems like the if condition for buffer[0] through to buffer[3] isn't fulfilled, or the ...
0
votes
1answer
37 views

How can I create a loop to read end of the card.raw file?

I'm using the basic expressions have been taught in the short videos but probably I'm implementing them wrong, especially I believe I'm using the wrong data types for my variables :/ My loop ...
0
votes
1answer
19 views

I don't understand the error message I'm getting

I don't understand the error message, and i've been trying to modify the code to fix the error but it still appears. // Blur image void blur(int height, int width, RGBTRIPLE image[height][width]) { ...
0
votes
0answers
15 views

not sure what is wrong with my code for edge in filter PSET4

void edges(int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE tmpGx[height][width]; RGBTRIPLE tmpGy[height][width]; int redtemp; int bluetemp; int greentemp; ...
0
votes
2answers
51 views

CS50 Recover (Pset4). What exactly is causing the segmentation fault?

CS50 NEWBIE here. Program successfully compiles but I keep getting a segmentation fault error when trying to run it. After some debugging, I think the problem has something to do with trying to close ...
0
votes
1answer
25 views

code is free(): invalid pointer and Aborted, and I don't understand why

at first it worked. But i make style and add more coment and it was broken. It makes all images but in the end: free(): invalid pointer Aborted and i don't understand why. I rewrite code and all work....
0
votes
1answer
47 views

why does it fail check50 for the last image?

#include <stdlib.h> #include <stdio.h> typedef unsigned char BYTE; int main(int argc, char *argv[]) { if (argc != 2) { return 1; } FILE *infile = fopen(argv[1], &...
0
votes
1answer
26 views

Pset4Ffilter - Starting Off

I'm doing the pset4 filter (less comfortable),but I just don't know where to start. Can someone pleases give me some starting off tips?
0
votes
1answer
48 views

Recover Week 4 Assignment--Code appears to work beautifully but check50 says no

My code works as I get all 0-49 images that look beautiful to me. After days of working on this, I really would appreciate any advice as to why the checker is saying my code failed the last three ...

1
2 3 4 5
34