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
1
vote
2answers
45 views

Major Help Needed on CS50 - Recover

I would love any possible help with this code. I think I've got the general idea, but I keep running into segmentation faults. Thank you to anyone who gets a chance to look this over! I've been very ...
0
votes
1answer
50 views

Pset4 Recover - Unexpected Output

My program outputs JPEG files, but not enough and they are corrupted. It has been a long day and it is Friday. Any kind of push in the right direction would be fantastic thank you. #include <stdio....
0
votes
1answer
30 views

PSET 4 Recover - Copy-Pasting 1 Line from 1 Place to Another Causes Huge Error

This Code Below Worked Fine, I got Passed!! #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <stdint.h> typedef uint8_t BYTE; int main(int argc, char *...
0
votes
1answer
48 views

PSET4 Recover: Where do my ###.jpg files end up?

My code looks right, and after some segmentation errors, I finally fixed that, but I've run into a problem: My created ###.jpg files don't actually seem to be written to anywhere, as in I can't find ...
1
vote
1answer
180 views

Week 4: Recover (invalid stdio handle)

As I'm sure you're aware, the goal of this assignment is to recover a number of deleted jpeg files from a provided memory card image. My code compiles and executes, but I'm receiving the error "...
0
votes
1answer
77 views

pset4 / recover / invalid or unsupported image format

I've been working on RECOVER from PSET4. I'm able to compile and it creates all 50 images. When I try to open any of the images I get an error saying "invalid or unsupported image format". I'...
0
votes
1answer
61 views

pset4 / recover Segmentation Fault

I have been trying to solve RECOVER from PSET4 and I keep getting a segmentation fault. Any ideas on why this happens? Thank you so much for any help. #include <stdio.h> #include <stdlib.h>...
0
votes
1answer
57 views

PSET4 recover: program compiles but doesn't recover any image

So, I'm using quarantine to learn C. I'm currently stuck at the Recover problem. My code compiles, runs but the result is not what I would've expected. I've explained this code to myself a thousand ...
0
votes
1answer
38 views

pset4 - My recover programme compiles but doesn't generate JPEGs as expected

After 12hrs of banging my head against this, and having trawled Stack Exchange, I've decided that it's time to ask for help! Really not sure where I'm going wrong, but suspect it's related to the ...
0
votes
1answer
102 views

pset4 recover fwrite function

I'm not sure where I went wrong with my code. Am I using fread and fwrite correctly? Thank you in advance!! //opens the file FILE *f = fopen(argv[1], "r"); //if the file contains nothing, ...
0
votes
2answers
72 views

PSET 4 Problem Set Recover

I've been working on Recover a few days now and managed to actually create a program that retrieves the images. The only problem is that they are not retrieved correctly and don't match what they are ...
0
votes
1answer
65 views

PSET4, RECOVER: Segmentation Fault

I have been trying to solve RECOVER from PSET4 and I keep getting a segmentation fault. Any ideas on why this happens? #include <stdio.h> #include <stdlib.h> #include <stdint.h> ...
0
votes
1answer
59 views

For PSET4 recovery, i can compile and now get 49 pictures, check50 error: “recovers middle images correctly recovered image does not match”

I think my "while" condition to read till the end of the file seems correct unlike most of other answers so i'm not sure what is wrong #include <stdio.h> #include <stdlib.h> #...
0
votes
1answer
46 views

Pset4 Recover. I think that I did well but it doesn't work

I was struggling with this code for three days. someone could help me? What should i fix? Please, if you are so kind, give me a tip, not the solution! I wrote a lots of comments to you can understand ...
0
votes
2answers
53 views

Issues with PSET4 recover (recover.c), can't create jpg's (segmentation fault)

Can't seem to find what is happening with my code, please help! I've been stuck in this problem for way too long. The jpg's are not created when I run the code. #include <stdio.h> #include <...
0
votes
0answers
26 views

Segfault error, please help

I really need help, I'm getting a segfault error. Please look through my code and help me, please. #include <stdio.h> #include <stdlib.h> #include <stdint.h> int main(int argc, char ...
0
votes
2answers
110 views

pset4 recover works correctly but fails check50. (not a duplicate because i want to figure out why MY code does not work)

this is my code: #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { // Check usage if (argc != 2) { return 1; } ...
0
votes
1answer
111 views

Last cs50 check not working help pls sos, I'm a beginner in C!

Can someone please point out to me what I did wrong? I keep getting the :( recovers 049.jpg correctly recovered image does not match error, I did all my research on other questions threads here ...
0
votes
2answers
51 views

Incompatible pointer types passing BYTE to FILE

#include <stdio.h> #include <stdlib.h> #include <stdint.h> //Define BYTE typedef uint8_t BYTE; int main(int argc, char *argv[]) {//Check if command line is correct// if (argc != ...
0
votes
3answers
113 views

Pset4 recover: Images recovered but check50 failed

I am currently stuck on this problem set, as it seems like I am able to recover the 50 jpgs but I am failing the check50. I am not sure what I am doing wrong and would appreciate some help. :( ...
0
votes
2answers
49 views

PSET 4 Recover, don't know what's causing seg fault

My code has been suffering from a seg fault, I followed the logic from the walkthrough pseudocode but unfortunately I cant seem to fix the issue. #include <stdio.h> #include <stdlib.h> #...
0
votes
1answer
58 views

Recover compiles fine, does not 'recover', and fails Check50

Any ideas where I'm going wrong? I seem to load all of the recovery data into image "000.jpg", never climbing out until I reach the end of the file. However, I cannot understand why this is so. ...
0
votes
0answers
108 views

fread() return value

I am working on recover, currently pset, and only my last photo is not processing properly. I am calling fread(buffer, 1, 512, inptr) to read 512 bytes of data at a time. The video says fread ...
0
votes
1answer
38 views

Code only detects one jpeg in pset4 recover problem

my code for pset4 recovery only detects one jpeg signature. Here's my code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <...
-2
votes
1answer
60 views

While loop for recover pset4

I need a plain English explanation of how the while loop operates for the fread statement. After reading in the first 512 bytes, how does it loop to the next 512 bytes till it gets to the last block?
0
votes
1answer
82 views

segmentation fault in recover probably due to sprintf

#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { if (argc != 2) { return 1; } FILE *memory_card = fopen(argv[1], "r"); if (!...
1
vote
1answer
77 views

How to skip loop iterations with debug50?

I'm struggling with the recover problem. I'm running a while loop that's more than 7 thousand iterations long. I get a segmentation fault because (i'm pretty sure) of the last or perhaps the last but ...
0
votes
1answer
121 views

CS50/PSET4/RECOVER- Error- “Can't open card.raw: file format unsupported”

Keep getting "Can't open card.raw: file format unsupported" error when running the code. Not sure what I'm doing wrong. #include <stdio.h> #include <stdlib.h> int main(int argc, char *...
0
votes
1answer
68 views

PSET4 Recover, Dynamic File Names

So far I've gotten to the point where I can recover one image. I'm to the point where I need to find a good way to make dynamic variable names. I thought of one way to do it, but it seems rather ...
0
votes
1answer
170 views

PSet4 Recover, only finds 22 corrupted photos, doesn't pass Check50

Originally, my code always returned Segmentation Faults whenever running it. I used printf statements to find and fix the segmentation faults, but now it is only finding 22 out of the 50 photos and ...
0
votes
1answer
536 views

Help with “RECOVER” Pset4

My program keeps failing the last 3 on check50 '.jpg not found'... I dont see what the problem is, can someone help? #include <stdio.h> #include <stdlib.h> #include <stdint.h> ...
0
votes
2answers
68 views

Pset4 recover: when I press enter, there's no results but just go to the next line

The code compiles and everything's good when I run it with debugger.(I set a breakpoint at the third line from the last.) But when I typed ./recover card.raw in command line and press enter, the ...
0
votes
1answer
85 views

How to write a fread function

Soo i'm a little confuse about the fread/fwrite function ... from what i understood in the videos, you need 4 input for those to work, let's use fread for the exemple fread("place to store the data",...
0
votes
1answer
61 views

PSET 4 Recover - Only recovering part of the photo?

My program to recover JPGs runs and creates the files, but was failing check50. So I ran the debugger, and it looks like it's only recovering a small portion of each JPG. Not sure what I'm doing ...
0
votes
1answer
73 views

Recover function in pset4

#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <stdbool.h> /* Open memory card Repeat until end of card: Read 512 bytes of data into buffer If ...
0
votes
1answer
44 views

Image does not match in the recovery problem

fellow programmers! I've been stuck for days trying to solve this problem, but i can't really seem to find the error in this code, which opens all the images but they do not match when i use the ...
0
votes
1answer
35 views

Why my Recover images are Invalid or “Unsupported Image Format”?

I'm stuck in Recover. I've been trying for two days. Now my code opens 49 images but they are "Invalid or Unsupported Image Format. I can't identify where I'm going wrong, please help me. #include &...
0
votes
1answer
74 views

“File size limit exceeded” in Recover - how does file writing work?

I've been quite frustrated by trying to make progress in Recover. When I run my code, I am unable to make even the first JPEG file as the program continues running until the file size is exceeded. I ...
0
votes
1answer
92 views

PSET4 Recover - Can't Read Card

Having a problem with Recover. The debugger shows that "buffer" is always 0000. Tried everything I could think of here. Any ideas? #include <stdio.h> #include <stdlib.h> #include <...
0
votes
1answer
46 views

CS50 Recover jpg files not found

I've been stuck on Recover for the last few days. I'm trying to work out why Submit tells me none of the jpg files are found. I've revised it multiple times, worked it out on paper... I can't figure ...
0
votes
1answer
78 views

Week 4 recover segmentation fault

I have spent two evenings on recover but I just can not figure it out. For the first time I managed to recover everything but the first image without any problems, so I did some searching and ...
0
votes
1answer
51 views

CS50 pset4 recover.c produces unsupported jpg images

Here is my code. Please help. #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <stdbool.h> #define BLOCK_SIZE 512 #define FILE_NAME_SIZE 8 typedef uint8_t ...
0
votes
1answer
35 views

pset 4 recover (My code compiles but does not do a thing)

Hello everyone so this is my code, it does compile and writes the recovers the first photo (that is 000.jpeg) but when it comes to continuing to the new jpeg it can only write one block(512BYTE) once ...
0
votes
1answer
633 views

(pset4) Fatal error: glibc detected an invalid stdio handle

everyone! I've been stuck with this one for a little while. Through debugging I found out that my problem is probably in the size parameter I'm trying to pass to fread() in line 33 (start of the while ...
0
votes
1answer
45 views

CS50 ~/pset4/recover Seg Fault

I have been trying to edit this code multiple times and keep getting a segmentation fault. I've tried debug50 and narrowed down the incorrect line to be on line 53 fwrite(block,sizeof(int),512,image) ...
0
votes
2answers
136 views

Why does my Cs50 recover programme correctly recover all images except the first one?

I wrote the below code and it recovers 51 images: 000.jpg to 050.jpg- all images except img 000 seem to have been found correctly. I'm not sure why the code isn't working? include include include ...
0
votes
1answer
57 views

PSET 4 Code fails two checks

Stuck on this problem for days and I can't figure out why my code is failing, I'll admit I'm struggling to really understand what my code is doing, like how the filename variable works. But I've ...
0
votes
0answers
48 views

Recover program: Can't produce the 50th jpg (049 jpg)

I've tried everything to get that last file, I even ran some printf statement test and the 4 indexes that show the start of a jpg are recognized 50 times in total but i'm still only able to produce 49 ...
0
votes
0answers
52 views

I am having trouble with the 2020 pset4 Recover assignment and even though my code compiles, it doesnt work, its not recovering the images

EDIT: I posted this 17 days ago please help. Heres my code and it wud be great if someone cud help A.S.A.P. thankyou! #include <stdio.h> #include <stdlib.h> #include<stdint.h> #...
0
votes
1answer
64 views

Recovers images, but Check50 is not happy!

I have successfully (or I guess not super successfully) recovers all 50 images, but where am I going wrong? Thanks! #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[])...

1 2
3
4 5
18