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
1 answer
66 views

CS50 Recover recovering corrupted images, and only 43 images

I'm attempting to solve the Recover problem, and I'm using a for loop to go through the bytes of the raw file. It spits out 43 images, some of which have the full image, but most are corrupted, and ...
Daniel Chettiar's user avatar
0 votes
1 answer
74 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 ...
Steven George's user avatar
0 votes
1 answer
34 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 ...
Steven George's user avatar
0 votes
1 answer
148 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 ...
rio's user avatar
  • 3
0 votes
1 answer
23 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 ...
Parth Shrivastava's user avatar
0 votes
2 answers
54 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&...
Gloria Isedu's user avatar
0 votes
2 answers
95 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 ...
Valerie Bryant's user avatar
0 votes
1 answer
67 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) { ...
human-tech's user avatar
0 votes
1 answer
30 views

check50 on recover pset 4 saying this what am i doing wrong

:) recover.c exists. :) recover.c compiles. :( handles lack of forensic image expected exit code 1, not 0 :) recovers 000.jpg correctly :) recovers middle images correctly :) recovers 049.jpg ...
iliketurtlz's user avatar
0 votes
1 answer
51 views

I know that my recover is wrong, but I'm not sure what steps to take-

I 'm getting a segmentation fault for my recover code. I know that it's wrong, and I think that this boils down to me not really understanding how to apply pointers/file functions. Maybe you could ...
mushie2's user avatar
  • 17
0 votes
1 answer
201 views

Pset4 - recover - issue with file pointers

I'm working on recover and I think I'm nearly there but I can't resolve an issue with file pointers. When I'm compiling I'm getting two errors both say error: use of undeclared identifier 'ptr'. I ...
Wh0am3ye's user avatar
0 votes
2 answers
125 views

Pset4 Recover: succesfully recovers first and second image, unsure as to why no other image is recovered (spoiler)

I must admit I'm having particular trouble in this assignment. Maybe it's the amount of new concepts. I think I have the idea down but I must me missing an error regarding the loop. I've tried ...
Matías Gómez Seeber's user avatar
0 votes
2 answers
219 views

Valgrind - 2 memory leaks | Recover.c | Pset-4

Valgrind encountered two errors in the following code. I'm not able to get why is this happening even when I close files and free allocs. Please help if you can. #include <stdio.h> #include <...
Ayush Dhingra's user avatar
0 votes
1 answer
29 views

Understanding the contents of the raw file

I'm playing around with file pointers in preparation for the Recover Problem. I'm trying to understand something here. I can't actually open up the raw file to read on my IDE. And neither can I read ...
echorashmi's user avatar
0 votes
2 answers
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 <...
Carlos Gonzalez's user avatar
0 votes
1 answer
129 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 ...
HAI LIN's user avatar
0 votes
1 answer
2k 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 ...
Henrique Baesa's user avatar
0 votes
1 answer
223 views

Pset 4 - Fopen returns NULL

Currently working on the Pset4 recover.c assignment. My code compiles correctly, however, when I execute, fopen return NULL. Based on my understanding from the shorts on file pointer and the lecture, ...
Bilal Junaidy's user avatar
0 votes
1 answer
72 views

pset4 Recover - need to break (^C) to exit

I'm recovering the files just fine, but my program seems stuck in the while loop. I've tried adding extra closing statements and adding else statements, but I can't seem to find where/why it won't ...
lurch101's user avatar
0 votes
1 answer
94 views

Having trouble getting recover off the ground

I'm sorry to do this but I'm fairly lost with this pset3 recover for cs50. I've been researching for hours and am no closer to figuring out how to utilize FILE *outptr = fopen and sprintf(filename, "%...
robmaci's user avatar
0 votes
1 answer
76 views

Pset4 - Recover: Weird output

This problem set is the worst and it made me cry 🤣 Take a look at this code: #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { // ...
Budi Salah's user avatar
0 votes
1 answer
247 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....
Emily's user avatar
  • 3
0 votes
1 answer
21k 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 ...
DylieWylie's user avatar
0 votes
1 answer
280 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 ...
Antwan Samir's user avatar
0 votes
1 answer
740 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 ...
Optimus 's user avatar
0 votes
1 answer
46 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, ...
Dawienchi's user avatar
0 votes
1 answer
220 views

problem with checking 4 bytes of jpeg

So i recently completer recover and it came out that the only problem was with the code that was actually told in the recover walkthrough about the checking of jpeg 4 bytes.The code was: if(block[0]...
TheGeek's user avatar
0 votes
2 answers
294 views

Pset 3 (Recover): Why are images still glitchy?

I've been having trouble with pset3's Recover exercise. My code successfully compiles and creates 50 jpegs, numbered 000 to 049. However, all images are terribly glitchy. Examples: I've scoured the ...
Razvra's user avatar
  • 3
0 votes
1 answer
130 views

PSET4 Recover spits out 50 images but they're all invalid

#include <stdio.h> #include <stdint.h> #include <stdlib.h> #define FAT_BLOCK_SIZE 512 // I figured out how to get block size from here "https://cs50.stackexchange.com/...
Ryan's user avatar
  • 11
0 votes
1 answer
64 views

Can't open generated JPGs

My code compiles and saves 50 JPG images with proper names, but when I try to open any one of them, I get the 'Invalid or Unsupported Image Format' error. What I'm doing wrong? Here is pseudo-code: -...
11223342124's user avatar
0 votes
1 answer
204 views

pset4 recover - my implementation recovers 50 jpegs but check50 rejects

I am having trouble with recover from pset4 - when I run it, it creates 50 images, apparently correctly formatted (000.jpg-049.jpg). However, check50 rejects it: :) recover.c exists. :) recover.c ...
turgid_secretion's user avatar
0 votes
2 answers
273 views

PSET 4 - Recover: recovers JPGs but doesn't pass check50

My implementation of Recover produces 50 JPGs but does not pass check50. I am stumped. Any help would be greatly appreciated. #include <stdio.h> #include <stdlib.h> #include <stdlib.h&...
Mark Scheer's user avatar
0 votes
1 answer
544 views

Can't recover 000.jpg

First time poster here. Cannot figure out why I can't recover this one image. And any time I make changes to the code to get at it, I end up losing all the images. Please help. // Recovers jpeg ...
Cho Loo's user avatar
  • 15
0 votes
1 answer
88 views

pset 4 recover still getting memory leaks

I've been told before that my code is getting memory leaks (when running Valgrind this becomes apparent) so I now free memory at the end of the program, but I'm still getting leaks. Even beyond ...
user21860's user avatar
0 votes
1 answer
61 views

Code runs, but no JPEGs are formed in recover

#include <stdio.h> #include <stdlib.h> #include <cs50.h> int main(int argc, char *argv[]) { // ensure proper usage if (argc != 2) { fprintf(stderr, "The program ...
Aisha's user avatar
  • 19
0 votes
1 answer
93 views

pset4 recover not sure why I get segmentation fault

Really clueless to why I get a segmentation fault on this problem, I have a hunch it may be something regarding the creation of the outfile. #include #include int main(int argc, char *argv[]...
user21860's user avatar
0 votes
1 answer
67 views

pset 4 recover, won't recognize file outptr

#include <stdio.h> #include <stdlib.h> // I got information about what to do with the buffer // from this stack exchangehttps://cs50.stackexchange.com/questions/2680/ //...
user21860's user avatar
0 votes
2 answers
69 views

PSET4 - Recover: Error in './recover': double free or corruption (top). Can't figure out what's wrong

I can't seem to figure out why this error is occurring. I used fclose() only once per file pointer. #include <stdbool.h> #include <stdint.h> #include <stdio.h> typedef uint8_t BYTE;...
inlovewith's user avatar
0 votes
1 answer
213 views

recover pset4 file handling

I got this code to work, but I have a few questions for my own clarification. On line 68 where I define the jpg title, why is it a single character? The actual title 001.jpg is much longer than a ...
Marie Urbina's user avatar
0 votes
1 answer
114 views

PSet4 recover: recovered files start with a wrong sequence

My recover program creates 50 files, but they do not open (it says "Invalid or Unsupported Image Format"). I opened some of the JPEGs with a hexadecimal editor and found out that they start with 00 d8 ...
Leonidius's user avatar
0 votes
2 answers
284 views

Character array values return 4 bytes instead of 1

I'm helping my son work on the recover.c assignment trying to recover JPEGs from card.raw disk image file. I'm running into a strange behavior trying to display bytes from my 512-byte buffer which is ...
George Ou's user avatar
0 votes
1 answer
187 views

Recover - images are blurry and incomplete

The images are created but come back as blurry messes. I can't see my bug so I'm hoping to get a hint. int main(int argc, char *argv[]){ // take in single card name if(argc > 2){ fprintf(...
Mote Zart's user avatar
  • 127
0 votes
1 answer
258 views

CS50 Recover did not pass check50

I am currently struggling to pass pset4, specifically on Recover. I already search other questions in forum and it seems there were no solutions to my problem, so I am stuck. From card.raw i could ...
Anesel1993's user avatar
0 votes
1 answer
658 views

Pset4 Recover - Segmentation fault using while loop (fgetc function)

When I ran the program, it said that there was a segmentation fault. I tried using debug50 to identify the source of the fault and it pointed to the line of code that I have bolded. I don't understand ...
Prav Elan's user avatar
0 votes
1 answer
286 views

pset4 recover with malloc having a segmentation fault

I can't seem to find the reason of why I'm getting the segmentation fault in my code. The moment my code starts to write the bytes of buffer, I encounter the fault Any help is really appreciated. #...
Candaş Ünal's user avatar
0 votes
2 answers
201 views

no any jpg found in recover.c

~/workspace/pset4/recover/ $ check50 cs50/2017/x/recover :) recover.c exists. :) recover.c compiles. :) handles lack of forensic image :( recovers 000.jpg correctly 000.jpg not found :( recovers ...
juanli's user avatar
  • 131
0 votes
1 answer
105 views

pset4, recover, nothing happens in terminal

I'm having alot of trouble understanding recover. So far, when i try to run the command ./recover card.raw in the terminal, nothing happens- not even an error message! if someone could guide me as to ...
Arhaz's user avatar
  • 7
0 votes
1 answer
130 views

pset4 recover.c Why are my pictures scrambled?

My attempt at recover.c almost works. It creates 50 jpegs and names them appropriately. And it fills them part way before getting scrambled. Here is an example: Here is my code: #include <stdio....
Dylan's user avatar
  • 13
0 votes
1 answer
293 views

pset4- recover invalid or unsupported image format

In recover my code compiles and runs. It then creates 50 images (named correctly) but they do not open and I get a 'invalid or unsupported image format' warning when I try to open them. I have looked ...
Iris Frenzy's user avatar
0 votes
2 answers
133 views

pset4, recover.c: fails to recover middle, end images with check50

First, I have read the forum's discussion rules, and I have reviewed every post relating to recover.c I can find on reddit, StackExchange, and the other discussion boards. Since none seems to address ...
BruceM's user avatar
  • 103

1 2 3
4
5
20