Skip to main content

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
1 answer
79 views

PSET4 - Recover - set output file pointer to NULL

case 1: FILE *file_out = NULL; case 2: FILE *file_out; "file_out" is a newly defined file pointer to where the recovered JPEG blocks will be written to. I tried both case 1 and case 2 and ...
Vincent Xu's user avatar
0 votes
1 answer
40 views

My Red and Blue values are wrong but all my green values are correct. It's pretty simple what i've done. What am I missing ? Please help

void blur(int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE tmpimage[height][width]; for (int i = 0; i < height ; i++) { for (int j = 0; j < width; j++) ...
voko axecer's user avatar
0 votes
1 answer
26 views

Any idea why i am getting this error in pset4

#include "helpers.h" #include <math.h> // Convert image to grayscale void grayscale(int height, int width, RGBTRIPLE image[height][width]) { // comb trw each row for (int i = 0;...
Vali Max's user avatar
0 votes
1 answer
104 views

pset4 recover error segmentation fault

Can i please get some help with my recover code? i have rewritten it so many times but i still get a segmentation fault i even unmalloc'd a few things but to no avail // recovers deleted images #...
jeddah's user avatar
  • 5
0 votes
1 answer
64 views

Pset4 (cs50) fails check50 (segmentation fault)

Here's my code : #include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int main(int argc, char *argv[]) { if (argc != 2) { printf("./...
Atmane Lee's user avatar
0 votes
1 answer
217 views

pset4 recover: segmentation fault when closing file

I have been stuck with this segmentation fault for quite a while now. After running valgrind I was able to determine that it happens when I close the output file at the end of the code, but I have no ...
None._'s user avatar
  • 1
1 vote
1 answer
48 views

Pset4 Blur filter (more comfortable) assign new struct to image does not work

I was trying to use the following code to complete the blur function. Everything seems fine but I just couldn't update the RGBTRIPLE variable image directly with another RGBTRIPLE variable I crreated. ...
adxyadxy's user avatar
1 vote
1 answer
120 views

Pset4 Filter (Less) - Invalid operands to binary expression (Int and RGBTRIPLE)

Hello. I'm facing a problem trying to compile this code. I got the error msg Invalid operands to binary expression ('int' and 'RGBTRIPLE') void blur (int height, int width, RGBTRIPLE image[height][...
Min Wai's user avatar
  • 11
0 votes
1 answer
163 views

Blur in cs50 problem set 4

My code for the blur filter works fine to edge, corner and middle pixels, but it doesnt work right for a whole 3x3 or 4x4 picture i've been trying everything but nothing seems to fix it. This is what ...
Ricardo Morim's user avatar
3 votes
1 answer
2k views

Questions regarding pset4 Blur filter (less comfortable)

After tinkering for a while with why my filter didn't work, I finally succeded with the following code: // Blur image void blur(int height, int width, RGBTRIPLE image[height][width]) { //make copy ...
Miloš Nenadić's user avatar
0 votes
1 answer
32 views

Recover: Encountering many problems

My code compiles fine, but no jpg files are created. It seems like the condition that checks for the start of a jpg is never true, so the body of that if condition never executes. I'm also having ...
khalildouis's user avatar
0 votes
1 answer
26 views

CS50 Pset 4 Reflect with Bubble Sort

I tried using bubble sort for Reflect, it goes something like this pretend I defined temp here for (int i = 0; i = height; i++) for (int j = 0; j = width - 1; j++) for (int k = 0; k = width - 1; k++) ...
Aaron Tan's user avatar
0 votes
1 answer
67 views

Code compiles but files are not read. Recover pset4

Trying to find the problem i could track it to the else statement where ""printf("Could not open file because NULL.\n");"" is located. The files are not read at all or ...
Francisco Azocar's user avatar
0 votes
1 answer
55 views

Why the pixels are not rendering correctly in recover problem?

I am working on recover problem and suffice to say I am just a beginner. Here is my code: #include <stdio.h> #include <stdlib.h> #include "stdint.h" #include "stdbool.h"...
Aylin Naebzadeh's user avatar
0 votes
1 answer
121 views

Pset4 recover 000.jpg 001.jpg 049.jpg are not found

PLEASE I am dying: I am searching for hours for the problem, but I can't find it. It compiles. At least 000. and 001. should be found but I get these results and I am full of remorse. Where could be ...
Liliana's user avatar
0 votes
1 answer
137 views

filter less: Reflection : image is reflected correctly but does not pass check50

void reflect (int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE invert[height][width]; for (int i=0; i<height; i++) { for (int j=width,s=0; j>=0; j-...
Bhavik Khatri's user avatar
0 votes
1 answer
249 views

lab 4 is not passing check50, but the volume is changing by the factor when we listen to the audio

// Modifies the volume of an audio file #include <stdint.h> #include <stdio.h> #include <stdlib.h> // Number of bytes in .wav header const int HEADER_SIZE = 44; int main(int argc, ...
Bhavik Khatri's user avatar
1 vote
1 answer
2k views

My CS50 PSET4 Filter (Less) Blur function doesn't pass check50 despite seemingly working fine

I've been working on CS50 PSET4 Filter (Less) and finally got a working blur function (or so I thought!) // Blur image void blur(int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE ...
jonathandavis's user avatar
0 votes
1 answer
78 views

Recovering problem

While debugging, the compiler doesn't enter the condition (although it should be entered at the first iteration), also I get segmentation fault in the fwrite line after the conidion I 'm including ...
Mohamed Hassan's user avatar
0 votes
1 answer
50 views

Blur problem (Less)

I can't catch the error in my code, I think that I 'm using the right Algorithm and approach. // creating a copy to apply blur on it RGBTRIPLE copy[height][width]; // initializing avaerages' ...
Mohamed Hassan's user avatar
0 votes
1 answer
52 views

pset4 recover doesn't recognize jpegs

I've been working on Recover for quite many hours now and I can't really understand what is wrong. Here I share my commented code. What I can tell you about its behavior is the following: It does not ...
nico_so's user avatar
0 votes
1 answer
48 views

Im busy with problem set 4(recover) and the image says Invalid or unsupported format. The sizes of the images look legit

I am not sure why my images are unsupported. Everything looks as if it works until you try to open the images. Even the image sizes look correct.(meaning they aren't 0bytes or all the same size or 512 ...
Dylan's user avatar
  • 7
0 votes
1 answer
27 views

pset4 CS50 IDE broken when opened card.raw

While I was working on pset4/recover I couldn't make it work as desired, so I wanted to check the first few bytes of card.raw manually. I double-clicked the file and now my cs50 IDE never loads and ...
nico_so's user avatar
0 votes
0 answers
172 views

Academic honesty

Question about the Academic Honesty after working on recover problem for more than 10 hours and watching the lecture , shorts , and walking through several times , and still facing lots of errors and ...
yusuf mostafa's user avatar
0 votes
1 answer
70 views

pset 4 recover, I can compile but no JPEGs returned

#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> typedef uint8_t BYTE; int main(int argc, char *argv[]) { if(argc > 2 || argc < 2) ...
anonymous's user avatar
0 votes
1 answer
97 views

CS50 PSET4 recover Segmentation Fault

Can someone point out why this code is resulting in segmentation fault? It's a code for the 'recover' question in pset4, cs50. #include <stdio.h> #include <stdlib.h> #include <stdint.h&...
Eyvie's user avatar
  • 3
1 vote
1 answer
37 views

PSET4 LESS BLUR function -Ending Edges problem 2nd version

New version of my previous problem here PSET4 LESS BLUR function -Ending Edges problem I know the problem is with the imitations but can't figure out what is it My code works fine but for the ending ...
Ahmed Elbessfy's user avatar
0 votes
1 answer
23 views

PSET4 LESS BLUR function -Ending Edges problem

My code works fine but for the ending edges not. I mean the right & bottom edges values. Here is my code : void blur(int height, int width, RGBTRIPLE image[height][width]) { // h = 400 w = ...
Ahmed Elbessfy's user avatar
0 votes
1 answer
39 views

PSET4/Recover -- Why am I getting "double free or corruption (top)"?

#include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int counter = 0; char filename[8]; FILE *img; BYTE buffer[512]; int main(int argc, char *argv[])...
General Noob's user avatar
0 votes
1 answer
430 views

Pset4 filter reflect segmentation fault

I'm currently trying out cs50's pset4 filter (less comfortable). The program compiles but when run, it outputs segmentation fault. When using check50, it showed that my reflect code passed three of ...
panda384's user avatar
0 votes
0 answers
71 views

My Filter program is not blurring the image correctly. And it is not able to open the input file. It shows it as NULL

Here is my code: #include"helpers.h" #include<math.h> #include<stdio.h> #include<stdlib.h> // Convert image to grayscale void grayscale(int height, int width, RGBTRIPLE ...
Fatmah Faridi's user avatar
0 votes
1 answer
57 views

Pset4 recover produces only 2 corrupted iamges

I am at Pset4 recover pset. When I run my code, it produces only 2 corrupted images here is my code : #include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE;...
Ahmed Elbessfy's user avatar
0 votes
1 answer
510 views

PSET4 Recover error: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *

I am at PSet4-recover. I can't compile code properly. Always get these errors : recover.c:47:31: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-...
Ahmed Elbessfy's user avatar
0 votes
1 answer
514 views

CS50 blur filter failed 3x3 and 4x4

I created a for loop checking each pixel around the one to be blurred. If the pixel was in range, its RGB values would be added to a total variable to then be averaged. My program works for all ...
Amie's user avatar
  • 3
0 votes
1 answer
57 views

Debug50 won't even open and I don't know what step to take next in lab4 Recover

Because I can't get debug50 to help me out, I don't know where to start to debug this program. I think I have an infinite loop somewhere, but I'm not sure. Any help to get me started on right path ...
Lperino's user avatar
  • 14
0 votes
1 answer
40 views

Getting an "Invalid or Unsupported Image Format" while trying to open images (Recover, Pset4)

I'm currently trying out CS50's Recover (PSET4). The program compiles and I manage to get back all the 50 jpgs. But I can't open them because the image isn't correctly returned and I get an "...
Hamster1303's user avatar
0 votes
0 answers
125 views

CS50/pset4/recover doesnt recover img 49

Hei All, I am running my version of recover and check50 validates every check apart from the last one This is my code. I really cant figure out what's wrong. #include <stdio.h> #include <...
MPimk's user avatar
  • 1
0 votes
1 answer
204 views

(PSET 4 - Recover) Why is first recovered image blank?

I am on problem set 4 recover and I have nearly completed it. I have written my code and it compiles but when I run it on the card.raw file it appears to recover all the 50 photos except the 1st one ...
Dre Johnson's user avatar
0 votes
1 answer
41 views

My Program is not recovering the jpegs correctly

My program is compiling properly it is even recovering the images but when I am opening the image to view, it is not opening. It is showing "Invalid or Unsupported file format". Please look ...
Fatmah Faridi's user avatar
0 votes
1 answer
166 views

pset4 filter blur less got stuck

i have been working on blur and it works just fine as i run it. but when i run check50 i get this : :( blur correctly filters middle pixel expected "127 140 149\n", not "145 160 169\n&...
esma hancer's user avatar
0 votes
1 answer
178 views

pset4 recover fread segmentation fault

guys I want to ask why am I constantly getting segfault with second fread inside of a while loop after checking jpeg header. first fread works perfectly going through first several 512bytes of card....
Hyukjae Ko's user avatar
0 votes
1 answer
28 views

The sepia code passes 2 first tests but doesn't pass the rest of those tests. What am I doing wrong?

This is the code I have written but it fails to produce the intended result. I am really not able to figure out why it's wrong. Can somebody help me? [snip] if (image[i][j].rgbtRed > 255) { ...
srushti mund's user avatar
0 votes
1 answer
77 views

Pset4 (Less). Filter sepia. In the output image, the white parts are magenta

For some reason, the image attached below is the output I get with Sepia filter. I don't know where the code is wrong. void sepia(int height, int width, RGBTRIPLE image[height][width]) { int k = 0;...
Kley Halisson's user avatar
0 votes
1 answer
47 views

Need clarity for Problem Set4 recover

I am working on set4 recover My program is always printing "Testing EOF", hence it looks card file is empty. Here is my code in detail. #include <stdio.h> #include <stdlib.h> #...
Fatmah Faridi's user avatar
0 votes
1 answer
100 views

Pset 4 filter less comfortable, cant open the output BMP file

So I just made the greyscale function and it passes check50 but when I try to open or download the output.bmp file, it doesn't show anything. Anyone know how to fix this? This was the command I put in ...
Yianni Kiritsis's user avatar
0 votes
1 answer
34 views

Pset 4 Recover output shows Segmentation Fault

#include <stdlib.h> #include <stdint.h> //to use uint8_t as BYTE typedef uint8_t BYTE; int main(int argc, char *argv[]) { if (argc != 2) { printf("INVALID. There ...
VooDooDarkMagic's user avatar
0 votes
1 answer
26 views

Filter - Structures & Headers

The problem statement states that BMP files have a particular header with: (1) BITMAPFILEHEADER 14 bytes long and (2) BITMAPINFOHEADER 40 bytes long. bmp.h (provided) includes the definitions of the ...
LorenzoPeve's user avatar
0 votes
2 answers
100 views

CS50 Recover - fread into buffer

I am working on CS50 Recovery and I am unable to get the program to check the JPEG starting header. I used debug50 and added a couple print statements to try and find the problem. Every time I run the ...
user16108583's user avatar
1 vote
1 answer
73 views

CS50 - PSET 4 - Filter - Edges

//Pixel buffer RGBTRIPLE pixelBuffer[height][width]; //Iterates on every pixel and calculates Gx and Gy for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++)...
Sakamoto Alderson's user avatar
0 votes
1 answer
82 views

cs50 Pset4 filter(more) blur

void add(RGBTRIPLE* a, RGBTRIPLE* b){ a->rgbtRed += b->rgbtRed; a->rgbtGreen += b->rgbtGreen; a->rgbtBlue += b->rgbtBlue; } // Blur image void blur(int height, int width,...
Ray's user avatar
  • 101

1 2
3
4 5
37