Questions tagged [recover]

recover.c, one of the assignments for Problem Set 4, will challenge you to search through the raw bytes of a camera's digital memory to recover a bunch of "deleted" JPEG images.

Filter by
Sorted by
Tagged with
0
votes
1answer
8 views

PSET4 RECOVERY does not recover images correctly

I have started working on PSET 4 RECOVERY. My program compiles successfully, it goes through the first 3 tests no problem, but for the love of me I cannot seem to find the problem. It just does not ...
0
votes
1answer
22 views

Segmentation Fault in CS50 Recover - pset4

I would appreciate some guidance on the below issue. I have seen the other threads with the same issue but haven't had any luck applying those fixes. I am getting the below error in my code and I can'...
0
votes
1answer
18 views

Recover PSET4 Corrupt images

i was working on pset4 recover and my code finds all the image, but everytime it writes to the image the image got corrupted, and i cant find the issue, checked the debugger and it seems going the way ...
0
votes
1answer
26 views

Wrote a simple recover.c program to extract the first image from card.raw but the image is corrupted?

that is the code I wrote can anyone tell what is wrong with my code!! FILE *file = fopen(argv[1], "rb"); FILE *outptr = fopen("000.jpg", "wb"); typedef uint8_t BYTE; ...
0
votes
1answer
34 views

Problem with Recover (Pset4)

everyone. I've been struggling with the Recover problem of Pset4. I really don't understand why I'm getting the following error message when applying the Check50 control: *Results for cs50/problems/...
1
vote
1answer
16 views

Recover - segmentation fault and other general problems

Hey guys so I've hit a bit of a wall with Recover, when I run my program I get segmentation fault but I also don't know how to end off one jpeg when another header pops up? In essence, I'm not sure ...
0
votes
1answer
20 views

PSET4 Recover fread/fwrite

PSET 4 is really taking me for a wild ride that I am not enjoying whatsoever. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> int num = 0; ...
0
votes
1answer
19 views

Recover finding all images but not passing check50

I know this has been brought up a few times before but none of the solutions seem to be relevant to the code that I have written below. My recover.c file compiles, executes and returns all 50 images ...
0
votes
1answer
11 views

Segmentation and bool fault in recover.c

Can anyone help? I keep getting a segmentation fault when trying to run recover.c. It compiles fine. My code is below. I do plan to add in the error returns once I can get this to work properly as ...
0
votes
1answer
13 views

CS50 Recover pset is causing segmentation fault

This is question is fairly common here, but I haven't seen code similar to mine. This has led me to doubt my screen thoroughly, so I come here asking for help. It doesn't throw any errors with either ...
0
votes
1answer
12 views

pset4 Recovered image doesnt match

I´m trying to solve the pset4 recover challenge, but i havent been able to make the program recover the full image, only one part of it. What am i doing wrong ?? This is my code: #include <stdio.h&...
0
votes
1answer
25 views

Recover code makes 000.jpg to 049.jpg, but jpgs are corrupt

I've been working on this problem for a little bit, but right now I have no clue why my code isn't working. Right now it spits out the 50 jpgs like it's supposed to, but they're all blank. Anyone have ...
0
votes
1answer
17 views

PSET4 Recover Problem

This is the result of my code: :) recover.c exists. :) recover.c compiles. :) handles lack of forensic image :( recovers 000.jpg correctly recovered image does not match :( recovers middle images ...
0
votes
1answer
25 views

Where am I mystaking ? pset4-RECOVER

I've been rewriting that code for about a week now and start beeing very confused about what I am doing wrong, I hope my logic isn't fully wrong but I have some doubts about my understanding of ...
0
votes
2answers
40 views

Pset4 recover segmentation fault when running

Finished the problem but when running check50 gets segmentantion faultand running ./recover card.raw . The error code is the following: :) recover.c exists. :) recover.c compiles. :) handles lack of ...
0
votes
2answers
36 views

Getting a segmentation fault in pset4 recover

I'm getting a segmentation fault when trying to run my program for pset4 recover. I've been trying for ages to debug it, but I'm finding it really difficult because when I try to use debug50, after ...
0
votes
1answer
72 views

cs50 2021 pset4 recover help

EDIT: Ok after trying for 3 hours after posting this I have finally managed to solve this pset. The problem wasn't actually a logical one but rather it was a problem with the type definition and the ...
0
votes
1answer
12 views

When I'm creating array

This has me confused. In the following code, I create an array of characters initialized at size 7. The array needs to store at least 6 characters, so I've made it large enough to do that (I think?). ...
0
votes
1answer
23 views

Pset4 Recover debugging help: “While loop has empty body”

I'm working on the Recover problem, and I'm unable to fix this error I'm getting when trying to compile: "while loop has empty body" If you look at my code I think what should be happening ...
0
votes
1answer
44 views

Help with recover.c! I tried to use recursion

The lines which attempt to stop the recursion using EOF don't seem to work. Can anyone help me see why? #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string....
0
votes
1answer
25 views

Recover - PSet 4

I am for some reason unable to generate any jpgs with my code; I think there's a mistake in the logic somewhere? Would be very grateful for some hints! Thank you! #include <stdio.h> #include <...
0
votes
1answer
45 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
19 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
1answer
36 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
14 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
21 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
27 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
26 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
1answer
22 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
1answer
19 views

The third last line of code is the one causing a segmentation fault. When removed, nothing happens and all I get is a $ on a new line in the terminal

#include <stdio.h> #include <stdlib.h> #include <string.h> #include <cs50.h> int main(int argc, char *argv[]) { #define BUFFER_SIZE 512 FILE *img = NULL; if(argc =...
0
votes
2answers
51 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 <stdint.h&...
0
votes
1answer
29 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
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
25 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
36 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
1answer
55 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
43 views

not recovering any JPEGs though the code works

can someone tell me what is wrong with my code it works and recovers but no images are found upon checking :) recover.c exists. :) recover.c compiles. :) handles lack of forensic image :( recovers 000....
0
votes
1answer
52 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
1answer
47 views

I really don't know why my code is not working pset4

I'm not good a programming but I'm really trying so I've been stuck for days in the same problem and any advice could be helpful Here's my code: #include <stdio.h> #include <stdlib.h> #...
0
votes
1answer
26 views

Recover used to make files and now doesn't (Spoiler Alert)

It took me a while to figure out why my files wouldn't be created, but eventually, I made a change that did it! I saved and left that session, and when I came back, nothing had changed, but when I ran ...
0
votes
1answer
27 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
1answer
20 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
46 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
42 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
2answers
57 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
52 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
53 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
25 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
36 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
53 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) { ...

1
2 3 4 5
18