Questions tagged [pset4recover]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3 votes
1 answer
5k views

If I use fread in a while loop, will it move the file pointer?

I am doing pset4 recover.c and have a bit of confusion.. Does this move the pointer? while(fread(buffer,1,512,card) == 512){ rewind(); // do I need to rewind? or just write what's in buffer? }
Baal's user avatar
  • 33
1 vote
1 answer
42 views

Problem Set 4 - Recover (timed out while waiting for program to exit)

After spending almost a week working on the code for the Recover exercise, I have finally made it work. However, when I check with check50, I get the error: :( program is free of memory errors timed ...
Stavros Marinos's user avatar
1 vote
1 answer
89 views

Pset4 Recovery Produces Corrupt Null Files & Skips An Image

I've been working at recovery for a while - I believe I'm nearly done with it - but right now my code is giving me serious problems. Currently, running ./recover card.raw produces 49 of the 50 images (...
Lucas C.'s user avatar
1 vote
1 answer
33 views

pset 4 - recover, can't figure out mistake

I can't figure out what I'm doing wrong, please help! #include <cs50.h> #include <stdio.h> #include <stdlib.h> #define BUFFER_SIZE 512 int main(void) { // open memory ...
Lakshya Dugar's user avatar
1 vote
1 answer
182 views

PSET4 Recover produces JPGs, but passes CS50 check only partially

My PSET 4 Recover code is able to recover the 50 jpg's from the raw file. However, when checking the code with the check50 it only partially passes. I checked a lot other related issues on SE CS50 ...
Richard's user avatar
  • 13
1 vote
1 answer
716 views

Pset4 recover using fread as condition

In the walkthrough Zamyla mentions using fread as a condition. I've tried using it as the while condition, hoping the loop would stop when fread returns 0 but I get only 26 heavily distorted jpegs ...
Hoya Coder's user avatar
1 vote
1 answer
162 views

Can not find jpeg..recover problem from cs50 pset4

so I was trying to solve this recover problem from cs50.IT compiles well but it shows me this following problem :) recover.c exists. :) recover.c compiles. :) handles lack of forensic image :( ...
Fayek Ahmed Rahat's user avatar
1 vote
1 answer
31 views

pset4 recover segmentation fault on code that compiles, I have looked many questions related to the problem but no luck so far

#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <cs50.h> typedef uint8_t BYTE; const int BLOCK_SIZE = 512; int main(int argc, char *argv[]) { if (argc != 2)...
turanzela's user avatar
1 vote
2 answers
57 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 ...
Thomas H's user avatar
1 vote
1 answer
51 views

CS50 recover (fclose giving segmentation fault)

found a few answers to the segmentation fault issue in CS50 recover while closing the file but I couldn't translate the answers to my issue: The last part: fclose(f); fclose(img); is resulting into ...
perkuche's user avatar
0 votes
2 answers
277 views

PSET4, Recover - Generated JPGs are blank

My code compiles and saves 50 JPG images with proper names, but when I try to open any one of them, all of them are blank, just grid. When I run check50, I get Segmentation fault error. What I'm ...
11223342124's user avatar
0 votes
1 answer
290 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 ...
lmcc's user avatar
  • 7
0 votes
1 answer
283 views

Recover pset 4 last image

I have been working on this for a long time. I used check50 on it and it reports that the last image isn't recovered correctly. Can someone provide insight? #include <stdio.h> #include &...
ssk4988's user avatar
0 votes
2 answers
60 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

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

pset4 recover 049.jpg recovered image does not match

I cant understand why 049.jpg is not working #include <stdio.h> #include <stdlib.h> #include <stdint.h> unsigned char bytes[512]; //counter for the jpg files int jpgCount = 0; ...
Asmat Ullah Khan's user avatar
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
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
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
2 answers
43 views

Pset4 recover- cannot open file for writing error

#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { if (argc!=2) { fprintf(stderr, "./recover nameofimagefile\n"); return 1; } char *...
Iberico's user avatar
  • 29
0 votes
1 answer
171 views

PSET4 Recover Can't Open JPEGs in the IDE

I've recovered all 50 JPEGs and when I download them to my computer and change the name from (for example) 000.jpg%OA I can see the picture correctly. However, in the IDE,if I open the same JPEG I get ...
George Wright's user avatar
0 votes
1 answer
37 views

PS4 - Recover - expected exit code 0, not 139

my program works well, images are created correctly. But when I make check50 i get this strange error expected exit code 0, not 139 :) recover.c exists. :) recover.c compiles. :) handles lack of ...
Black Beard's user avatar
0 votes
1 answer
45 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
353 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
103 views

pset4 recover error segmentation fault

Can i please get some help with my recover code? i have rewritten it so many times but i still get a segmentation fault i even unmalloc'd a few things but to no avail // recovers deleted images #...
jeddah's user avatar
  • 5
0 votes
1 answer
32 views

Recover: Encountering many problems

My code compiles fine, but no jpg files are created. It seems like the condition that checks for the start of a jpg is never true, so the body of that if condition never executes. I'm also having ...
khalildouis's user avatar
0 votes
1 answer
25 views

Recover code runs but doesn't generate any jpegs

at sure I didn't know how to even begin, but slowly started realizing how i can tackle this problem. after a bit i was stuck on how some stuff works so i looked up some recover tutorials that helped ...
mohammed qadi's user avatar
0 votes
1 answer
67 views

Code compiles but files are not read. Recover pset4

Trying to find the problem i could track it to the else statement where ""printf("Could not open file because NULL.\n");"" is located. The files are not read at all or ...
Francisco Azocar's user avatar
0 votes
1 answer
52 views

pset4 recover doesn't recognize jpegs

I've been working on Recover for quite many hours now and I can't really understand what is wrong. Here I share my commented code. What I can tell you about its behavior is the following: It does not ...
nico_so's user avatar
0 votes
1 answer
96 views

CS50 PSET4 recover Segmentation Fault

Can someone point out why this code is resulting in segmentation fault? It's a code for the 'recover' question in pset4, cs50. #include <stdio.h> #include <stdlib.h> #include <stdint.h&...
Eyvie's user avatar
  • 3
0 votes
1 answer
57 views

Pset4 recover produces only 2 corrupted iamges

I am at Pset4 recover pset. When I run my code, it produces only 2 corrupted images here is my code : #include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE;...
Ahmed Elbessfy's user avatar
0 votes
1 answer
497 views

PSET4 Recover error: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *

I am at PSet4-recover. I can't compile code properly. Always get these errors : recover.c:47:31: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-...
Ahmed Elbessfy's user avatar
0 votes
1 answer
199 views

(PSET 4 - Recover) Why is first recovered image blank?

I am on problem set 4 recover and I have nearly completed it. I have written my code and it compiles but when I run it on the card.raw file it appears to recover all the 50 photos except the 1st one ...
Dre Johnson's user avatar
0 votes
1 answer
49 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 ...
Pierre Catala's user avatar
0 votes
1 answer
32 views

In Recover, when I run check50, it says timed out while waiting for program to exit. But when I run it with ./recover card.raw, it works perfectly

#include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int check_jpg(BYTE array[]); int main(int argc, char *argv[]) { if(argc != 2) { ...
Sachit Bansal's user avatar
0 votes
1 answer
21 views

Segmentation Fault in recover.c

I keep getting a segmentation fault in my recover.c and I am not sure why. I have been stuck on this one for days. The idea is that we are trying to recover some deleted jpg files from a card. Thank ...
Summer Ng's user avatar
0 votes
1 answer
316 views

Need Help with using malloc and PSET4 Recover

I cannot tell what's wrong with my code. When using check50 I keep getting the results below: :) recover.c exists. :) recover.c compiles. :) handles lack of forensic image :( recovers 000.jpg ...
benjabit's user avatar
0 votes
1 answer
43 views

buffer array full of \000, pset 4 recover segfault

I am experienceing a problem where nothing is beign read into a buffer array, but for the life of me I am unable to figure out why. I have read through other threads with users experiencing the same ...
Bob Tan's user avatar
0 votes
1 answer
45 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 ...
MelPradeep's user avatar
0 votes
1 answer
182 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 &...
Mazen's user avatar
  • 5
0 votes
1 answer
52 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....
YoussefSaeed's user avatar