Skip to main content

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

What is the return value of fread when it reads slack space?

This is my code for recover.c in pset4: #include <stdint.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { if (argc != 2) { printf("...
StarBirds007's user avatar
0 votes
1 answer
14 views

check50 says program isn't free of memory errors while valgrind says no memory leak is possible in recover.c

There is only one use of malloc in the program and it is freed before the program exits: #include <stdint.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) {...
StarBirds007's user avatar
0 votes
1 answer
37 views

pset 4 recover program error

there is a problem in my recover program. when ever i run it, it always shows this command "free(): double free detected in tcache 2 Aborted (core dumped)."i cant point my finger to the ...
dhan8293's user avatar
1 vote
1 answer
34 views

Pset 4 Recover - Unable to read card.raw -fread issue?

Trying to see where I am getting caught up here. I thought that I had a grasp on the idea of the function. It complies and does not result in a segmentation fault although it does not pass check50. I ...
Jeff's user avatar
  • 21
0 votes
0 answers
21 views

i have a problem in p.set4 (recover)

can someone help me please ?? i have a problem in week 4 (recover)!! i wrote my code and it was succesfully excuted but when i used check 50 i have got errors which said that my images do not match ...
Alaa Elfallah's user avatar
0 votes
1 answer
57 views

Pset4- recover: recovered jpgs appear to be empty

I tried to implement recover through the simplest and shortest way I could imagine. The code compiles and saves 50 JPGs with proper names, but when I open them, all of them are just empty and even ls -...
Fawz's user avatar
  • 1
0 votes
2 answers
65 views

CHECK50 Passes, but I Get 6/7 When Submitting

I've just completed pset4 - recover. I did quite a bit of debugging and was finally able to pass all checkmarks with check50, style50 and Valgrind. After submitting I checked my grade and I received 6/...
csharp1321's user avatar
0 votes
1 answer
47 views

Recover PSET 4 Week 4 - skipping while loop

This is a follow up to my previous question. After I went through my code on debug50 it shows that my while on line 35 is not going through. I checked my code with other others on this site and they ...
Raheel A's user avatar
-1 votes
1 answer
48 views

CS50 PSET 4 Recover - segmentation fault and blank file

I have been trying to solve this question for a while now but I am still not sure what is wrong. The program works fine before the while loop but after it stops working and when checking with check50 ...
Raheel A's user avatar
0 votes
1 answer
47 views

CS50 Recover Problem: Why does it give Segmentation fault (core dumped)

I have looked all over to see other people with issues with segmentation default on this problem. I don't see that i have the same issue and i am not sure what i did wrong // Ensure proper command ...
TrytoLearn's user avatar
0 votes
0 answers
36 views

CS50 PSET4 Recover. Files created, images visible, why check50 fail?

Why isn't check50 clearing even though the files are created and the images are visible? #include <stdint.h> #include <stdio.h> #include <stdlib.h> typedef uint8_t BYTE; typedef ...
Don Tan's user avatar
0 votes
1 answer
91 views

program is free of memory errors

Im about to finish pset4, currently on recover! Everything is ok at the first look, program compiles, however, there is a problem when I run check50. As you can see from the title, something is off ...
liza's user avatar
  • 13
0 votes
1 answer
31 views

i am unable to open my cs50 card.raw file

#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { //open memory card FILE *memorycard = fopen("card.raw","r"); if (memorycard =...
Gold Isaac's user avatar
0 votes
0 answers
23 views

program in recover pset4, please help me find the errors and if you could add how to debug the code, its will be helpful

#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 filename\n"); ...
Trex Vanga's user avatar
0 votes
0 answers
24 views

Recover, Produces 50 JPGS but doesn't pass check50 and the memory leak check is neutral (can't check)

#include <stdio.h> #include <stdlib.h> #include <string.h> int check(); int main(int argc, char *argv[]) { int name = 0; FILE *fptr = NULL; char filename[8]= {0}; int x = 0; int i = ...
Mohamed Khedr's user avatar
0 votes
1 answer
58 views

in pset4, recover, why is the first jpg found treated differently from the other jpg files?

I'm starting to work on pset4, recover, and (as you can tell) things are not going well. I read posts from other students working on the same problem and realize some of them check for the jpg header ...
Alvaro Barboza's user avatar
0 votes
1 answer
34 views

pset 4: recover only recovers grey and black squares

I am unsure on why my code is only recovering black and grey squares, instead of images. I have tried closing the file img in multiple places, and I still can't seem to solve the problem, I believe it ...
Robbie's user avatar
  • 5
0 votes
1 answer
39 views

PSET4 Recover Successfully Generates Images But Does Not Match Correctly

Currently on PSET4 Recover. My code manages to generate 50 images which can be opened, however check50 states the images do not match correctly. Would anyone be able to offer some advice? #include <...
chonker's user avatar
0 votes
1 answer
38 views

pset4 recover segmentation fault (core dumped)

I am getting segmentation fault and i was searching on the internet, comparing with other codes, reading this forum, etc. and i still can not fix mine. Explaining my code from the while: read the ...
Victor Araya's user avatar
0 votes
1 answer
28 views

Pset4 Recover getting segmentation fault but I have no idea why

This is the answer I have come up with for pset 4 recover: #include <stdio.h> #include <stdlib.h> #include <stdint.h> int main(int argc, char *argv[]) { // Ensure proper usage ...
dbergkamp5's user avatar
0 votes
1 answer
47 views

Why does the 0.49 jpg file doesn't match correctly?

I'm doint the recover PSET04. I think, I've done everything correct expect of the 0.49 jpg file. It says that it doesn't match correctly. And the last error in Check50 is "can't check until a ...
AlvaroAndLukeTheCoder's user avatar
0 votes
1 answer
31 views

Problem set 4 recover producing only one image, that too is corrupted

here is my code: #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> const int BLOCK_SIZE = 512; int main(int argc, char *argv[]) { // ensure ...
Martund's user avatar
  • 101
0 votes
1 answer
23 views

PSET4 Recover - Why do I get Segmentation Error from Check50

my recover program compiles fine. When I run the program, I do not get any errors. When I look at the 50 outfiles, I can see the pictures with the image preview. Valgrind indicates that there are no ...
Zach's user avatar
  • 1
0 votes
1 answer
30 views

P4 Recovers only first 512 bytes

im really struggling with this one and your help would be really appreciated My code is working quite good but theres a error with writing file wich i cannot fix // i will start with line where i ...
Marek Pecnik's user avatar
0 votes
1 answer
48 views

pSet4: Recover Memory Leaking after opening a file

When I try to run my solution to recover in cs50 problem set 4, I get a segmentation fault. I tried to use check50, and I got a poor response for memory leaks. :( program is free of memory errors ...
Team's user avatar
  • 5
0 votes
1 answer
138 views

CS50 pset4 recover Segmentation fault (core dumped) problem

I have already solved 2 errors from valgrind but cant solve the last 2 segmentation fault. Also how can i read the valgrind output efficiently. I just got lost between the text. Thanks beforehand! #...
Follang's user avatar
0 votes
1 answer
318 views

Recover runs, but leaks 472 bytes in 1 block

The code for recover (pset4) works fine, and has passed check50, except for the last check - no memory leaks. Valgrind shoots back: ==5482== Memcheck, a memory error detector ==5482== Copyright (C) ...
Hamster1303's user avatar
0 votes
1 answer
56 views

Code for Good ol' Recover returns all fifty images (000-049), but doesn't pass Check50

I have gone through about 12 questions on the same issue - the code for recover works, but check50 isn't being kind: :) recover.c exists. :) recover.c compiles. :) handles lack of forensic image :) ...
Hamster1303's user avatar
0 votes
1 answer
23 views

Pset 4 Recover finding 51 files

for recover my code returns 51 jpegs, was wondering where i went wrong? none of the jpegs seem viewable from vscode as well. int main (int argc, char *argv[]) { if (argc < 2|| argc <= 1) { ...
duckpro's user avatar
0 votes
1 answer
90 views

Why do the recovered images do not match (pset4 recover)

#include <stdio.h> #include <stdlib.h> #include <stdint.h> int main(int argc, char *argv[]) { typedef uint8_t BYTE; FILE *file = fopen(argv[1], "r"); int counter=0; FILE *...
daydayday1234's user avatar
0 votes
1 answer
51 views

PSET4 Recover segmentation fault

Good afternoon/morning, I'm having problem with Problem set 4 Recover, My code can compile but Segmentation fault (core dumped) keeps going out, I checked on debug50 and it seems the segfault occurs ...
Eva Chen's user avatar
0 votes
1 answer
18 views

Segmentation fault in pset4 recover when reading file

I tried solving recover.c. But when I tried to run it (without valgrind), I got segmentation fault. When I ran it again with valgrind, it told me that the culprit is in line 40, where I read the file ...
IgorArnaut's user avatar
0 votes
2 answers
51 views

Hello guys... Good day. I'm currently on the pset 4 (recover). program is working well, but the (valgrind) requirement in the check50 isn't checking

#include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int main(int argc, char *argv[]) { // Check that command-line arguments is 2 if (argc != 2) ...
Hendrix obuks's user avatar
0 votes
2 answers
17 views

Getting segmenatation fault even though i freed memory

#include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int main(int argc, char *argv[]) { // Only allow 2 command line arguments if (argc != 2) ...
lukadeving's user avatar
0 votes
1 answer
57 views

PSET 4 Recover Valgrind Check

Valgrind indicates I have 49 memory blocks left to close. Otherwise, the code satisfies check50. I'm thinking I need to nest the fclose functions within the loop, but I can't get it right. Thoughts? ...
mcweebus's user avatar
0 votes
1 answer
23 views

Pset 4: Why Error at end of checkcs50?

this is how my code looks. Only *filename has a malloc attached to it. Why this valgrind error. This is how the logs look.
Atharva Deodhar's user avatar
0 votes
1 answer
152 views

Memory leak in Recover (PSet4)

I'm working on Recover and it all works fine but I've got a memory leak I don't know how to get rid of. My code is this: #include <stdio.h> #include <stdlib.h> #include <stdint.h> ...
software_dev_wannabe's user avatar
0 votes
1 answer
84 views

CS50 Problem Set 4 - Recover, fclose undeclared identifier issue

My first time posting on the forum so hope someone can help. I've been scratching my head over this code for a while now and can't understand why I get the undeclared identifier! My code seems to ...
Jonathan Pittock's user avatar
0 votes
0 answers
45 views

CS50x pset 4 - Recover = correct code, no jpegs?

I've been working on CS50x pset 4 - Recovery and check50 is saying that I have done everything correctly. The problem is that I don't see any jpgs in the folder. What do I seem to be doing wrong? #...
Raymond Agustine Santos's user avatar
0 votes
1 answer
104 views

PSET 4 Recover I am not getting all the checks in my program

The program works fine but the last condition is not fulfilled. Valgrind tests failed. I know I have to close the opened files but I cant seem to figure out where to do that. Please help. Following is ...
Abdullah Shahzad's user avatar
0 votes
1 answer
365 views

RECOVER, can't see images

I've been working on recover for days now. I've been able to solve the segmentation fault issues and the code compiles and creates all 50 jpg files, but doesn't write the files correctly. I played ...
Alvaro Barboza's user avatar
0 votes
1 answer
128 views

My recover program makes all 50 jpegs without errors or segmentation faults. However I only recover the first image correctly. What am I missing?

I can make the file without error. When I run the code all 50 jpeg files are created. When I check the images only the first one appears and the rest say error while loading. When I run check50 I get ...
EmTeeDubz's user avatar
0 votes
1 answer
43 views

I set up Recover with buffer files, but I'm not sure where the image is being sent to, are we rewriting the original card.raw file? I'm confused

#include <stdio.h> #include <stdlib.h> #include <stdint.h> //number of bytes in jpeg file const int BLOCK_SIZE = 512; int main(int argc, char *argv[]) { //ensure proper use if(argc !=...
Stevek's user avatar
  • 1
1 vote
1 answer
37 views

CS50 PSET 4 Recover Segmentation fault (core dumped)

I am working on PSET4 Recover from the CS50 course, but I can't seem to get it to work. I keep getting segmentation fault (core dumped). I've tried changing my code many times, but keep the ...
Noflik's user avatar
  • 11
0 votes
1 answer
544 views

Understanding Pset4 Recover Valgrind Errors

My code for Recover is passing all the tests in Check50 except for the final one on memory errors. When I run valgrind ./recover I get this: When I look into the details of why I'm not passing ...
getsendy's user avatar
0 votes
1 answer
80 views

In recover, image files are not writing bytes correctly. Why?

All 49 images are written but they don't have the accurate data. I can't find where I made the mistake. Here's my code: #include <stdio.h> #include <stdlib.h> #include <stdint.h> // ...
Sakib Arifin's user avatar
0 votes
1 answer
118 views

Pset4 Recover, only getting first block of data written to image file

I have trawled through previous posts for hours trying to find a solution, but I can not seem to find anything similar. If I have missed it, then apologies! The code is recovering/opening all 50 image ...
Aran's user avatar
  • 3
0 votes
1 answer
69 views

In pset4 recover, do I need to loop 512 bytes to make it work?

Here's my code: #include <stdio.h> #include <stdlib.h> #include <stdint.h> // Function headers int fsize(FILE *fp); int main(int argc, char *argv[]) { // Check the validity of ...
Sakib Arifin's user avatar
0 votes
1 answer
104 views

CS50 PSET 4 RECOVER WORKING BUT NOT PASSING CS50 - SEGMENTATION FAULT

This is for CS50 PSET 4 recover. I am struggling with identifying the segmentation fault that check50 shows. Upon running, it seems to generate the 50 images correctly without error, and valgrind does ...
jgoteam's user avatar
0 votes
1 answer
78 views

PSET4 - Recover - set output file pointer to NULL

case 1: FILE *file_out = NULL; case 2: FILE *file_out; "file_out" is a newly defined file pointer to where the recovered JPEG blocks will be written to. I tried both case 1 and case 2 and ...
Vincent Xu's user avatar

1
2 3 4 5
20