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

reverse .wav file not working correctly

I tried running this code to reverse the .wav audio file, but it does not work as required. Can someone explain what's wrong? // create array of size (size) to store blocks BYTE buffer[size]; // ...
Ahmed ElToukhy's user avatar
0 votes
0 answers
132 views

Professor Code Rejected by CS50 Check50

When submitting the code to check50, I get the following error message: ":( Little Professor accepts valid level Cause: Timed out while waiting for program to exit." When I run the program ...
RedHorseMane's user avatar
0 votes
1 answer
31 views

Problem set 4 recover producing only one image, that too is corrupted

here is my code: #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> const int BLOCK_SIZE = 512; int main(int argc, char *argv[]) { // ensure ...
Martund's user avatar
  • 101
0 votes
1 answer
23 views

PSET4 Recover - Why do I get Segmentation Error from Check50

my recover program compiles fine. When I run the program, I do not get any errors. When I look at the 50 outfiles, I can see the pictures with the image preview. Valgrind indicates that there are no ...
Zach's user avatar
  • 1
0 votes
1 answer
30 views

P4 Recovers only first 512 bytes

im really struggling with this one and your help would be really appreciated My code is working quite good but theres a error with writing file wich i cannot fix // i will start with line where i ...
Marek Pecnik's user avatar
0 votes
1 answer
38 views

PS4 - Recover - expected exit code 0, not 139

my program works well, images are created correctly. But when I make check50 i get this strange error expected exit code 0, not 139 :) recover.c exists. :) recover.c compiles. :) handles lack of ...
Black Beard's user avatar
0 votes
1 answer
369 views

CS50: Pset4: Filter-More : "filter compiles :expected exit code 0, not 2" while running Check50

My code compiles fine with no errors but when running check50 it fails at the second check saying filter compiles: expected exit code 0, not 2. Main returns 2 when more than one argument for filters ...
Tristan Wiese's user avatar
0 votes
1 answer
8 views

PSET4 recover Can someone help identify why Seg fault valgrind doesn't find anything

#include <stdio.h> #include <stdlib.h> #include <stdint.h> int main(int argc, char *argv[]) { if (argc != 2) { return 1; } FILE *input = fopen(argv[1], &...
LukeD's user avatar
  • 3
0 votes
1 answer
57 views

Segfault while declaring 2d array in filter-more's edges function. Probably a lack of memory?

At the very start of the edges function i try to declare an array to hold the image with black borders (now the first comment), but as i've discovered using printfs, it causes a segfault. I searched ...
Decowry's user avatar
0 votes
1 answer
85 views

Pset4 Sepia Errors - 3x3 and 4x4 images

I just ran my code through check50 and it's throwing the following errors: :( sepia correctly filters more complex 3x3 image :( sepia correctly filters 4x4 image But I looked further into the issue ...
scarmonies's user avatar
0 votes
1 answer
17 views

Problem Set 4 - Sepia appears to work, but the colors doesn't match the check50 results

Could someone help me understand what I did wrong? void sepia(int height, int width, RGBTRIPLE image[height][width]) { int sepiaRed = 0; int sepiaGreen = 0; int sepiaBlue = 0; for (...
Azvd's user avatar
  • 1
0 votes
1 answer
140 views

CS50 pset4 recover Segmentation fault (core dumped) problem

I have already solved 2 errors from valgrind but cant solve the last 2 segmentation fault. Also how can i read the valgrind output efficiently. I just got lost between the text. Thanks beforehand! #...
Follang's user avatar
0 votes
1 answer
106 views

pset4 filter-more All functions work when I test it but check50 gives error

I struggled a long time with this problem, and I saw other people had almost the same question and got answers but I didn't get to solve the problem. All four functions seems to work but when I test ...
Jareg's user avatar
  • 3
0 votes
1 answer
324 views

Recover runs, but leaks 472 bytes in 1 block

The code for recover (pset4) works fine, and has passed check50, except for the last check - no memory leaks. Valgrind shoots back: ==5482== Memcheck, a memory error detector ==5482== Copyright (C) ...
Hamster1303's user avatar
0 votes
1 answer
57 views

Code for Good ol' Recover returns all fifty images (000-049), but doesn't pass Check50

I have gone through about 12 questions on the same issue - the code for recover works, but check50 isn't being kind: :) recover.c exists. :) recover.c compiles. :) handles lack of forensic image :) ...
Hamster1303's user avatar
2 votes
2 answers
2k views

.wav file incorrectly reversing

Not able to pass final test for check50, however the only information I have is "file is not reversed as specified". I assume this means that I failed to properly reverse the data in the ...
Danyal Ahmed's user avatar
0 votes
1 answer
21 views

Can't figure out what's wrong with blur on filter-less pset4. Getting different errors each time I try to compile and run even if no code is changed

When trying to compile and run blur one of two things happens, even if I don't change the code at all: I either get a warning saying my int red, green, or blue variables are not used. Which I think is ...
user avatar
0 votes
1 answer
93 views

Why do the recovered images do not match (pset4 recover)

#include <stdio.h> #include <stdlib.h> #include <stdint.h> int main(int argc, char *argv[]) { typedef uint8_t BYTE; FILE *file = fopen(argv[1], "r"); int counter=0; FILE *...
daydayday1234's user avatar
0 votes
1 answer
36 views

How can I read an image from a file to a buffer?

I want to read 'image[width][height]' but anytime I do it I encounter this error message "incompatible integer to pointer types passing 'RGBTRIIPLE' to a parameter of type 'FILE *' (aka ...
Yunus's user avatar
  • 3
0 votes
1 answer
197 views

CS50 PSET 4 Filter-less, Blur function not filtering 3x3 and 4x4 images correctly

I have read many similar problems on here about the same issue. I believe my function is correct, although redundant and not very stylish. It should however get the job done. I get the same pixels ...
BrassyGiraffe's user avatar
0 votes
1 answer
66 views

CS50 Filter-Less Reflect Function

I've been racking my brain about this problem for what should be a pretty simple issue. No matter what I've tried, I haven't been able to get an output image that is flipped - just one that is an ...
Danyal Ahmed's user avatar
0 votes
2 answers
51 views

Hello guys... Good day. I'm currently on the pset 4 (recover). program is working well, but the (valgrind) requirement in the check50 isn't checking

#include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int main(int argc, char *argv[]) { // Check that command-line arguments is 2 if (argc != 2) ...
Hendrix obuks's user avatar
0 votes
2 answers
17 views

Getting segmenatation fault even though i freed memory

#include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int main(int argc, char *argv[]) { // Only allow 2 command line arguments if (argc != 2) ...
lukadeving's user avatar
1 vote
1 answer
116 views

Pset4 filter-less reflect function not passing check50

So i came up with this solution to the reflect function. It seems to properly reflect all the images but i'm getting all errors on check50. Trying to figure out what went wrong. We are encouraged to ...
ljsmith's user avatar
  • 21
0 votes
1 answer
57 views

PSET 4 Recover Valgrind Check

Valgrind indicates I have 49 memory blocks left to close. Otherwise, the code satisfies check50. I'm thinking I need to nest the fclose functions within the loop, but I can't get it right. Thoughts? ...
mcweebus's user avatar
0 votes
1 answer
23 views

Pset 4: Why Error at end of checkcs50?

this is how my code looks. Only *filename has a malloc attached to it. Why this valgrind error. This is how the logs look.
Atharva Deodhar's user avatar
1 vote
1 answer
803 views

(Edited) CS50P - PSET 4 - LITTLE PROFESSOR

I've made some corrections, the answers for CHECK 50 are the same though. I'm not getting it, the workability of the code is fine (working as expected, even when testing by 'How to Test' section). I ...
Julian Rodrigues's user avatar
0 votes
1 answer
152 views

Memory leak in Recover (PSet4)

I'm working on Recover and it all works fine but I've got a memory leak I don't know how to get rid of. My code is this: #include <stdio.h> #include <stdlib.h> #include <stdint.h> ...
software_dev_wannabe's user avatar
0 votes
1 answer
29 views

Why does make helpers return this?

Here is the error message in text: filter-less/ $ make helpers /usr/bin/ld: /lib/x86_64-linux-gnu/Scrt1.o: in function _start': (.text+0x1b): undefined reference to main' clang: error: linker command ...
L. C. Jimenez's user avatar
0 votes
2 answers
111 views

PSET4 - Little Professor : Program seemingly working but fails some tests

my program seems to be working appropriately while completing the problem's requirements. I don't know if my solution is just outright wrong or what is happening really. Here's my code : #prompt user ...
Walter Black's user avatar
0 votes
1 answer
148 views

CS50, Filter, Edges --> Variable '__' set but not used, although it is being used

I am attempting to finish the final function for problem set 4 (filter - feeling more confident) and I have come across the error stating that non of my variables GxBlue, GxGreen....GyRed are being ...
CamWheeler135's user avatar
0 votes
1 answer
149 views

Why does my Reflect function for pset4 filter (less) "correctly filter an image that is its own mirror image" but fail all other checks?

My reflect function correctly filters an image that is its own mirror image but for every other check fails. Here is the terminal output of submit50: :( reflect correctly filters 1x2 image ...
lexicypher's user avatar
0 votes
1 answer
128 views

My recover program makes all 50 jpegs without errors or segmentation faults. However I only recover the first image correctly. What am I missing?

I can make the file without error. When I run the code all 50 jpeg files are created. When I check the images only the first one appears and the rest say error while loading. When I run check50 I get ...
EmTeeDubz's user avatar
0 votes
1 answer
43 views

I set up Recover with buffer files, but I'm not sure where the image is being sent to, are we rewriting the original card.raw file? I'm confused

#include <stdio.h> #include <stdlib.h> #include <stdint.h> //number of bytes in jpeg file const int BLOCK_SIZE = 512; int main(int argc, char *argv[]) { //ensure proper use if(argc !=...
Stevek's user avatar
  • 1
0 votes
1 answer
549 views

Understanding Pset4 Recover Valgrind Errors

My code for Recover is passing all the tests in Check50 except for the final one on memory errors. When I run valgrind ./recover I get this: When I look into the details of why I'm not passing ...
getsendy's user avatar
0 votes
2 answers
96 views

What's wrong with my sepia code? pls help

My sepia code are as follows: // Convert image to sepia void sepia(int height, int width, RGBTRIPLE image[height][width]) { // Comb through each row for (int i = 0; i < height; i++) { ...
Duodecimy's user avatar
0 votes
1 answer
442 views

Filter less, Blur, why does my code not blur the edge and 3x3 and 4x4 image?

I am stuck at the blur function in filter less. Your task is to calculate the average RGB value of the surrounding pixel in one row and one column of a bmg image, including the middle pixel. It works ...
Karl's user avatar
  • 5
0 votes
1 answer
131 views

Filter blur errors

I'm working on the filter-less problem in pset4. I've got all of my functions to work properly except for the blur function. I am getting the following errors I believe due to problems with how I'm ...
getsendy's user avatar
0 votes
1 answer
342 views

Check50 fails at "code compiles" but code compiles and runs for blur, reflect and grayscale

I guess I'm doing something wrong, but the problem is the following: I'm working on pset4 (filter-more) and already implemented the -g, -b and -r options (-e still missing). Within VSCode, my program ...
kai.468's user avatar
0 votes
1 answer
80 views

In recover, image files are not writing bytes correctly. Why?

All 49 images are written but they don't have the accurate data. I can't find where I made the mistake. Here's my code: #include <stdio.h> #include <stdlib.h> #include <stdint.h> // ...
Sakib Arifin's user avatar
0 votes
1 answer
118 views

Pset4 Recover, only getting first block of data written to image file

I have trawled through previous posts for hours trying to find a solution, but I can not seem to find anything similar. If I have missed it, then apologies! The code is recovering/opening all 50 image ...
Aran's user avatar
  • 3
0 votes
1 answer
69 views

In pset4 recover, do I need to loop 512 bytes to make it work?

Here's my code: #include <stdio.h> #include <stdlib.h> #include <stdint.h> // Function headers int fsize(FILE *fp); int main(int argc, char *argv[]) { // Check the validity of ...
Sakib Arifin's user avatar
0 votes
1 answer
215 views

Image blurs but check50 fails for filter less. Why?

The image is blurry and everything seems to work fine. But check50 fails. Hence, I am not sure where I made the mistake. // Blur image void blur(int height, int width, RGBTRIPLE image[height][width]) {...
Sakib Arifin's user avatar
0 votes
1 answer
104 views

CS50 PSET 4 RECOVER WORKING BUT NOT PASSING CS50 - SEGMENTATION FAULT

This is for CS50 PSET 4 recover. I am struggling with identifying the segmentation fault that check50 shows. Upon running, it seems to generate the 50 images correctly without error, and valgrind does ...
jgoteam's user avatar
0 votes
1 answer
35 views

Why is my array code not working in case of pset4, filter's reflect function?

The purpose of reflect is to invert the array of pixels from right to left. So, I decided to create an array and store the data with a negative count loop. Then repopulate the array with a positive ...
Sakib Arifin's user avatar
0 votes
1 answer
28 views

Pset 4 Blur: Keep getting close yet wrong values but I can't find problems in my code

hello so I've been coding blur for a few days and have been running check50 for a while, and I keep getting results that show that the pixel values are just off by a max range of 10. It is really ...
Irwan Ahmed's user avatar
0 votes
1 answer
354 views

Pset4 (Filter-Less) Reflection: Not getting correct values on Check50

Image seems to be reflected correctly but the program doesn't pass check50. Code: void swap(RGBTRIPLE *a, RGBTRIPLE *b); void reflect(int height, int width, RGBTRIPLE image[height][width]) { for (...
Mike Osborn's user avatar
0 votes
1 answer
235 views

Pset4 (Filter-Less) Greyscale not passing check50

I tried implementing the GreyScale function but I didn't got the average values of the pixels correctly. I don't know what I'm doing wrong. Any hints will be appreciated. My code: void grayscale(int ...
Mike Osborn's user avatar
0 votes
1 answer
86 views

Filter (more) blur function fails check50

I've hit a bit of a brick wall writing a blur function for filter (more). This is my second go at refactoring the code, and although it produces a blurred image without any issues (no weird edges, ...
leftcase's user avatar
  • 113
0 votes
1 answer
103 views

CS50x PSET4 (Filter) - BLUR

This code is supposed to blur an image together with other supporting files as per CS50 Pset4. I am able to compile my code with no errors and run the program but it does not seem to blur my image ...
someone's user avatar

1
2
3 4 5
37