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

Recover cs50 Please help!

Can somebody please help with this question? ... and also I tried to debug and apparently it doesn't run my while loop and i don't understand why. while (fread(buffer, 512, 1, fraw) == 1) so ...
0
votes
1answer
65 views

(Recover) Segmentation fault

I was trying to complete the recover problem and it's giving me a segmentation fault. Any help would be appreciated. #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #...
0
votes
1answer
111 views

CS50 Recover.c | No idea what and where i'm going wrong | Can't debug or compile in CS50 IDE

I'm trying to debug in CS50 IDE but I'm continuously receiving this error; debug50: recover: No such file. and if I try to compile it says this "make: *** No rule to make target 'recover'. Stop." ...
0
votes
1answer
73 views

Still stuck on Recover Pset3, but getting closer

really sorry, not sure how to format copy-and-pasted code so it renders correctly in this forum. I'm hoping for a hint or two on how to get my Recover program (PSet 3, 2018) to work. I'm able to get ...
0
votes
1answer
66 views

pset3 “Recover”

I am facing some troubles, only one blank image is generated , any help? // Program to recover lost photos. #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <...
0
votes
1answer
121 views

why is check50 returning error of lack of forensic image and some jpg not found

this is my code // Open the card.raw file and check for NULL FILE* card_ptr = fopen("card.raw", "r"); [admin removed rest of code] and this is my error message generated from check50 :) recover.c ...
0
votes
1answer
42 views

Can't debug recover

I can't figure out what's wrong in my code. I'm getting 49 blank images along with gibberish files with jpg extension like below. Please drop a comment if anything is unclear in my code. Edit: ...
0
votes
1answer
128 views

Recover produces 49 blank images

I know that there are many other issues with my code, but I cannot seem to understand why only 49 images are recovered. Also, it would be great to get any pointers to why all of the recovered are ...
0
votes
1answer
60 views

Recover help - only 2 imgs are getting recovered

#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { if(argc != 2) { fprintf(stderr, "Usage: ./recover <filename>\n"); return 1; } ...
0
votes
1answer
92 views

Error on running recover

#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { if(argc != 2) { fprintf(stderr, "Usage: ./recover <filename>\n"); return 1; } ...
0
votes
1answer
69 views

How can I find out the size of what i have just read with fread()?

currently my code looks like this. int finds_reading_length(FILE* the_open_file, int the_block_size) { fseek(the_open_file,-the_block_size,SEEK_CUR); BYTE* buffer[the_block_size + 1]; ...
0
votes
1answer
231 views

Not Recovering the last “Recover” image

Having an incredibly tough time figuring out where my error is. The JPEG outputs look good but when I do check 50, I'm getting a :( for "recovers 049.jpg correctly - recovered image does not match....
0
votes
1answer
145 views

CS50 pset3 recover

After running it, I got the error massage "double free or corruption (top) Aborted". And I only got 000.jpg. Need some advice, thanks. int main(int argc, char *argv[]) { //ensure proper usage ...
0
votes
1answer
7k views

Recover: Fatal error: glibc detected an invalid stdio handle

I'm trying to do the recover assignment, but when I try to run it I get the error: Fatal error: glibc detected an invalid stdio handle Aborted I have no idea what this means or where to start to ...
0
votes
1answer
47 views

PSET3 Recover generates 50 files, but they are only 0-50% complete. Review appreciated

#include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int main(int argc, char *argv[]) { // ensure proper usage if (argc != 2) { ...
0
votes
1answer
122 views

Stuck on recover for 1 month - a couple of issues

So anyways, ive been stuck on recover for like a month because of some issues, im completely lost and id appreciate some feedback on my program. here are the issues: 1. the program only finds 4 jpegs ...
0
votes
1answer
14 views

How do I change the value of “a” via “b”?

e.g. Input: int a = 1; int b = a; b = 5; printf("%i \n", a); Output: 5 I have tried writing things like int* b = &a; b = 5; However i cant change b into an integer from a pointer?
0
votes
1answer
64 views

Pset4 'Recover' - Help! How can I solve this segmentation fault?

For pset4 'Recover', I'm facing a segmentation fault but I cannot find what I did wrong in my code. If I use echo$? to find where the bug is, it returns the value 1. Can someone help me to point me in ...
0
votes
1answer
329 views

CS50 Recover compiles, but doesn't compile on check50?

on the 2019 pset 3 on CS50, my code for "Recover" is working and compiling, but when I go to check50, it fails to compile. Picture of code: https://pastebin.com/rCALvDjq Picture of error messages: ...
0
votes
1answer
20 views

i have tried it with small diffs a lot of times.i feel more comfortable about this, but still not working.what am i doing wrong??thanks in advance

// creat a counter that keepw trach of jpegs found int counter = 0; // crate a string filename for sprintf char filename[8]; // FILE* picture = NULL; // chech if we have found ...
0
votes
1answer
51 views

Pset 4--51 files created instead of 50

Apologies for including all my (60 lines) of code, but I've been thoroughly confused by this for a while. I've written code to do Recover, and it's working fine and recovers images perfectly--it just ...
0
votes
1answer
37 views

pset4: check50 say that recover.c compiled with an exit code of 1 and not 0

I completed my code and it recovers all images fine. However, when I ran check50 for recover, I received this error code with a domino effect on the rest of them: https://legacy.cs50.me/checks/...
0
votes
1answer
106 views

What's wrong with this recover code?

I wrote some code for recover that seems to me to be recovering the image correctly (I can see pictures of people for all 50 images), but for some reason, check50 says that 049.jpg does not match the ...
0
votes
1answer
54 views

jpg's are not proper, mix of multiple images. Can anyone tell me whats wrong?“RECOVER”

here is my code while (fread(buffer, 512, 1, inptr) == 1) { if (buffer[0] == 0xff && buffer[1] == 0xd8 && buffer[2] == 0xff && (buffer[3] & 0xf0) == 0xe0) ...
0
votes
1answer
52 views

PSET3 Recover - Creating only textfiles for .JPG not images

My version of Recover for pset3 is creating 50 .jpg files but only as textfiles not images and I can't work out why. I've looked through this forum and saw one similar question but the issue ...
0
votes
1answer
63 views

PSET3 Recover: My code works when I make the buffer an array, but not when I use malloc

My code works perfectly when I make the buffer I use in fread and fwrite an array of unsigned chars, but when I use malloc to allocate memory space I get segmentation faults (this is the opposite of ...
0
votes
1answer
38 views

Pset4 recover.c fwrite if header is not found but already found the first jpeg

Can someone explain to me, why will there be a case where the first jpeg has already been found but subsequent jpeg doesn’t match the header? I thought all jpegs should match the header? If (...
0
votes
1answer
76 views

pset4 recover - doesn`t recover all files

Struggling with recover at this moment. My code creates just 8 pictures out of 50 - from 2nd to 9th. Other jpegs are also made but i am unable to see them due to "Invalid or Unsupported Image Format". ...
0
votes
1answer
24 views

Fread doesn't return new values to buffer - recover - pset4

I am currently working with recover and when I first compiled my program with debug50, my program was able to return 6 corrupted files without a propre name. When I wanted to get a closer look as to ...
0
votes
1answer
65 views

pset3 recover, only get 49 jpgs and all are wrong by check50, but look correctly

I recently started with CS50 and I struggle a bit with pset3's recover. While the jpgs look correct to me, my code only recovers 49 jpgs total, not the 50 which are expected. Check50 fails on the ...
1
vote
1answer
68 views

pset3 Recover - problem with final image

Hi I'm working on recover in pset3 and seems there is some problem when my code ends, can anyone point out the direction I should look into? Check50 returns the following error while all others are ...
0
votes
1answer
50 views

Need help with recover

I have been working with recover for a long time and I have a great problem with detecting the beginning of a JPEG. I have tried for a long time to no avail. I feel my problem may be with buffer but ...
0
votes
2answers
96 views

Pset3 recover __ How can I read and store data from card.raw to an array, and print this data-array byte by byte?

(This is the 1st time I use this site) I've tried many different ways, and all failed. Mostly 0s are being printed. Any idea how to approach this? I've spent the entire week on this already. Actually,...
0
votes
1answer
152 views

problem with recover.c using malloc and fread

i tried to write a function that sample 4 bytes from card.raw file but i doesn't work because fread doesn't put any data into block buffer so i wrote this simple code and i found out that fgetc works ...
0
votes
1answer
70 views

CS50 Recover image does not match

I have been working on this problem for a while but could never get it to work. Check50 says that the recovered image does not match. When I opened the recovered images manually, they are all blank. I ...
0
votes
1answer
96 views

Recovered image does not match pset3

I can't figure out what is wrong with my code. I recovered images from 000.jpg to 050.jpg. This is my code #include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef ...
0
votes
1answer
276 views

Recover.c; Need explanation about how to implement “write 512 bytes until the new jpeg is found”?

I am completely stuck right now when it comes to implement: Write 512 bytes until the new jpeg is found. Could anyone give me idea how to implement this step? Here is my code: // Declare ...
0
votes
1answer
32 views

cs50 Recover segmenation fault

I am working on the CS50 Recover Problem and got stuck on the segmentation fault. #include <cs50.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { ...
0
votes
1answer
54 views

recover.c producing random image 🙁

recover.c is always producing this image: Here is my code: #include <stdio.h> #include <stdint.h> typedef enum {false, true} bool; // Bool int main(int argc, char *argv[]) { if (...
0
votes
0answers
39 views

recover.c spits out images that are partially recognizable

recover.c compiles and runs normally, but it produces 21 images that have chunks of different images mixed in. Here are the images: 000.jpg: 001.jpg: 002.jpg: 003.jpg: 004.jpg: Because I'm too ...
0
votes
1answer
52 views

pset3 recover is fopen changing the first value in my buffer?

My code for pset3 works and recovers all the images as it is supposed to however I realised that when I call fopen the first value in my buffer array becomes 0 I fixed this by changing the value back ...
0
votes
1answer
48 views

CS50 recover - images are some kind of blank

//My program creates images of different sizes but without content (just black and white pixels). Someone can help me? #include <cs50.h> #include <stdio.h> #include <stdlib.h> #...
0
votes
1answer
57 views

All 50 images look good but failing on middle images on check50 “:( recovers middle images correctly recovered image does not match”

I thought I was there, I was failing on the last image not matching also, but after looking through similar questions I realised that I was checking for EOF before the read of the raw file and not ...
0
votes
1answer
116 views

recover.c:43:34: error: use of undeclared identifier 'out' fwrite(temp, 1, 512, out);: WHAT?

When I compile my program, clang is probably not working. I get this when I compile: ~/pset3/recover/ $ make recover clang -fsanitize=signed-integer-overflow -fsanitize=undefined -ggdb3 -O0 -std=c11 -...
0
votes
1answer
56 views

Pset4 - Recover - Segmentation fault when trying to free buffer

I have run the debug50 and it seems the seg fault occurs after trying to free memory here: // if not start of a new jpeg and we HAVE NOT already found one before if (block_buffer[0] != 0xff &&...
0
votes
1answer
141 views

PSET 4 recover doesn't pass check50 - “recovered images do not match”

All images are recovered, and when I open them, they all display correctly (I checked every one of them in the IDE), yet my program is not passing check50. Why? Here's my code: #include <stdio.h&...
0
votes
1answer
70 views

cs50 Recover — Segmentation fault and too many jpegs

I'm stuck with the debugging the below code. I keep getting way too many jpg files written and a segmentation fault. Thanks in advance for the help. I'm new to programming and this one is kicking ...
0
votes
1answer
45 views

Pset4: Recover - Reach EOF to “early” aka. doesn't recognize beginning of new jpg

I am fighting with the recover challenge in pset4. Had some progress and was able to detect 20 images. But then my condition for finding EOF is true and the program stops. I think the problem is, ...
1
vote
1answer
192 views

pset3 recover not sure how the code works

I'm taking baby steps towards writing the code for recover. So far I have written this: int count = 0; int blocks = 0; // Loops through the whole card. while (feof(card_in) == 0) { // declares ...
0
votes
1answer
158 views

Pset4 - recover, unable to pass check50

#include <stdio.h> #include <stdlib.h> int main (int argc, char *argv[1]) { // ensure the arguments are correct if (argc != 2) { fprintf(stderr, "Usage: ./recover filename\n"...

1
3 4
5
6 7
18