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
11 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
9 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
20 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
17 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
14 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
7 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
23 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
21 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
21 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], "r"); FILE *...
0
votes
1answer
17 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
34 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 ...
0
votes
0answers
17 views

Week 4 recover seg fault

#include <stdio.h> #include <stdlib.h> #define BYTE 512 #define NAME 8 int main(int argc, char *argv[]) { //check for valid input if(argc != 2) { //Promt user for valid input printf("...
0
votes
1answer
24 views

So i have written the recovery code which compiles but all the images are Invalid and Unsuported format

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

PSET4 Recover: Check50 shows error

#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> typedef char* string; typedef uint8_t BYTE; int main(int argc, char *argv[]) { if (argc != 2) { ...
0
votes
0answers
29 views

Problem with filter (pset 4): Blur and edge

All the filters on the filter program work well, but check50 is giving me a few errors, which I think, is due to rounding issues. But, I have checked and re-checked the code for those errors, and ...
0
votes
0answers
13 views

PSET4 Filter Blur by 4 nested for loops

I am trying to implement my idea on Blur function. My main assumption is to get this done using nested 4 for loops as follow: void blur(int height, int width, RGBTRIPLE image[height][width]) { ...
0
votes
1answer
24 views

pset4 recover error - timed out while waiting for program to exit

i am getting a timed out error but don t understand why...? also i can see all the pictures except the last one (049.jpg) ... #include <stdio.h> #include <stdlib.h> int main(int argc, ...
0
votes
1answer
18 views

Pset4 Recover JPEG images do not match

Getting closer on Pset4 Recover but still working through some issues. I am now generating jpegs (yay!) but they apparently do not match the original images. So I am getting three errors: :( recovers ...
0
votes
0answers
19 views

Why are the recovered jpgs messed up?

Sorry for asking such a general question but I cannot understand why my code does not recover the images fully. In most of the images one can see a fraction of the image. check50 tells me that there ...
1
vote
2answers
20 views

Blur only working with middle pixel

I've been stuck in this problem for a while, and the code only works when its inputted a middle pixel. Does anyone have a clue? I've searched everywhere for this particular issue, but I have only ...
0
votes
1answer
27 views

Pset4 Recover Problem With Seg Fault *Updated*

Getting closer on this now and am no longer getting a segmentation fault. However, my Jpeg images created by the program are not correct. I think part of the problem is that I am writing rather than ...
0
votes
1answer
24 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
0answers
11 views

CS50 filter more edge

I've been stuck for hours trying to solve this, so I would appreciate someones help lol So my edges filter is only passing the test for the middle pixel: I can't figure out what is wrong with my code ...
0
votes
1answer
19 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
0answers
20 views

Recover, almost there… images doesn’t show correctly

I think I'm very close to getting this one right, but I've been trying different codes with the same results so I think my logic must be wrong. This code finds correctly the jpegs and creates the ...
0
votes
1answer
16 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
32 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
0answers
22 views

My blur function doesn't pass check50

so I modified the code from last time, and it seems that instead of making copies of the image and calculating on them, takes the first if statement and makes it the new image so all the other values ...
0
votes
0answers
10 views

cs50 pset4 filter edge function. HOW TO FIX STACK OVERFLOW

void edges(int height, int width, RGBTRIPLE image[height][width]) { float b[height][width]; float g[height][width]; float r[height][width]; int gx_b[height][width]; int gx_g[height][width]; int ...
0
votes
0answers
5 views

cs50 pset4 fliter more edge function. CODE IS GETTING COMPILED BUT WHILE RUNNING IT IS SHOWING STACK OVERFLOW. HOW TO FIX IT

void edges(int height, int width, RGBTRIPLE image[height][width]) { float b[height][width]; float g[height][width]; float r[height][width]; float *blue; blue = malloc(sizeof(float)); float *green; ...
0
votes
0answers
9 views

Pset4-Filter Blur function doesn't pass check50. What's wrong?

I have been working on this function for about a week and have tried multiple ways, I have come up with a code that seems right to me but it presents errors when using the check50. This is the code I ...
0
votes
1answer
24 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
0answers
9 views

i started doing pset4, managed to get edges to work but green is always off, can someone please help me find out what i did wrong

int cap (int value) { return value < 255 ? value: 255; } RGBTRIPLE get_edge(int i, int j, int height, int width, RGBTRIPLE image[height][width]) { int Gx[3][3] = {{ -1, 0, 1}, {-2, 0, 2}, {...
0
votes
1answer
30 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
27 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
0answers
12 views

problem set 4 recover, segmentation fault

#include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int main(int argc, char *argv[]) { if (argc != 2) { printf("Usage: ./recover image\n"); ...
0
votes
1answer
32 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
46 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
54 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
27 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
40 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
31 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
41 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
31 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
24 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
34 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
30 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
0answers
19 views

pset4 (less) filter - blur please help

I've been stuck on this project for a while... I looked at other people's questions but still cannot find our where I did wrong. Can someone help me see where the bug is... void blur(int height, int ...
0
votes
1answer
49 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
43 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, ...

1
2 3 4 5
33