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

Pset4 - Recover - 51 empty jpg file

My program creates 51 empty(grey) jpg files. Is problem in fwrite? Can't cope with it. Thanks for help! /** * recover.c * * Computer Science 50 * Problem Set 4 * * Recovers JPEGs from a ...
0
votes
1answer
75 views

Pset 4 recover not passing check50

My code only recovers images till 008.jpg and does not pass the 000.jpg or 0001.jpg test of check50. What is wrong with my code? Here is my code - https://pastebin.com/QmJG7ccX UPDATE 1 - https://...
1
vote
1answer
1k views

Am I using sprintf correctly?

As suggested, I am employing sprintf to write the file names for the recover assignment. I am not sure if I am using the pointer * correctly. The documentation for sprintf shows the first argument to ...
0
votes
1answer
139 views

Detecting if we already found a jpg

I'm having trouble figuring out how to print extra 512bytes, if the first jpg is longer than that, like how to loop UNTIL it hits the next 4 header indicators. In this code example I've tried with a ...
0
votes
1answer
234 views

Recover pset4: help with pseudocode logic

I finally passed resize and now I'm on this pset. This time I'm trying to really focus on doing a good pseudocode since I feel a bit unsure about who to tackle the problem. In particular, I'm not sure ...
0
votes
1answer
76 views

pset4 recover cannot append rest of file to the first bit

I can find the beginning of the 50 files. I am creating the files and I am writing to them.I suspect things go wrong after the first 512 bytes. When I open in hexcode I cannot see the signature of a ...
0
votes
1answer
119 views

No JPEG images printed in recover.c

Since my program compiles fine I am wondering why nothing seems to be outputted from it. I looked at a few threads, but the only close question I found was here Pset4 recover.c compiles, but can'...
0
votes
1answer
138 views

pset4 recover compiles, makes jpgs, but doesn't pass check50

My code passes 000.jpg check but misses on middle and end jpgs. :( recovers middle files correctly :( recovers last file correctly I looked at the hex code for the jpegs and it seemed fine, the ...
0
votes
1answer
98 views

Pset 4 Recover - EM : \ expected an exit code of 0, not output of “image 16990724\n”

I can retrieve all 50 photos, it works as far as I can see, but check50 won't let me pass. It says I don't recover any file correctly, it expects an exit code of 0 and my code doesn't produce that. I ...
3
votes
1answer
1k views

pset 4 recover - Bitwise operator

I'm on pset 4 recover and stuck, trying to understand the bitwise operator, if (buffer[3] & 0xf0) == 0xe0) Can someone tell me if my understanding is correct? The if condition checks the value at ...
0
votes
1answer
71 views

Pset4 Recover.c works locally but fails check50. Valgrind and GDB give no errors

The program recovers the pictures locally, but does not when run on the CS50 IDE. Code: [Edit: removed for Academic Honesty rules.] Valgrind log: ==8397== Memcheck, a memory error detector ==8397== ...
0
votes
2answers
422 views

PSET4: Recover - How to check if already found JPEG?

Need to figure out how to identify if I already have a JPG that I have found. So that if I have it will close the previous image and then start a new one. My thought was that I need to check if my ...
0
votes
1answer
42 views

Segmentation fault occurs when I run recover.c

I've been unable to figure out the reason for the segmentation fault.This is the code attached below.I know it's got something to do with the while loop but I cannot figure it out. #include<stdio....
0
votes
1answer
62 views

PSET4 recover! dynamically allocated array does not seem to work

Hope all is well. This is probably a stupid question but I am going to ask it anyway. I have finally finished Recover (PSET4). I initially dynamically allocated an array as follows to store my 512 ...
0
votes
1answer
245 views

a problem with sprintf in recover

#include <stdio.h> #include <stdlib.h> #include <stdint.h> int main(int argc, char *argv[]) { // check arguments if (argc != 2) { fprintf(stderr, "USAGE: ./recover raw_file\n"); ...
0
votes
1answer
135 views

Recover finds all images except the last one

My program fails to recover the last JPEG. I see all the JPEGs but CS50 Check doesn't see the last file. I checked it with Valgrind and had no memory leaks. I suspect it has something to do with EOF ...
0
votes
2answers
94 views

Problem with incrementing recover.c

The variable count stops incrementing at 1 and I don't know why. #include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int main(int argc, char* argv[]) ...
0
votes
0answers
48 views

pset4-recover(what is wrong in my code??)

#include<stdio.h> #include<stdlib.h> int main(int argc,char* argv[]) { unsigned char buffer[512]; char filename[8]; int jpegfound=0; FILE *jpegimg = NULL; if(argc != ...
0
votes
0answers
134 views

PSET4 recover not passing check50

I get the output of all 50 images which can be viewed but it fails all CS50 checks. :) recover.c exists :) recover.c compiles :) handles lack of forensic image :( recovers 000.jpg correctly :( ...
0
votes
1answer
147 views

Recover only recovers beginning portion of photos

I'm having an issue where the code below runs properly and generates the correct number of files, however it only produces the tops of images for all files (i.e. I can see sunglasses but not the ...
0
votes
1answer
137 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 ...
0
votes
1answer
637 views

pset4 recover.c - working with fread() and malloc()

I'm attempting recover.c and I'm interested in clearing up a few things about fread() and malloc(). I tried to sample the first few bytes of the card.raw file but I keep getting the same two errors: ...
1
vote
2answers
54 views

2 check50 errors to go

My program creates 50 jpegs run once no errors! ... Pseudocode: while fread buffer from card.raw while first 4 bytes is jpeg header // start of jpeg create filename fopen ...
0
votes
1answer
50 views

pset 4 recover does not produce any images

I've been working on recover, and it compiles correctly, and followed the pseudocode presented in the instructional video. I feel like I am probably overlooking part of the process. I think I am ...
0
votes
1answer
62 views

pset4(recover-less): Segmentation Fault

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

Code for recover but not executing

I had written the code for recover it is compiling. But I don't why it's not executing. my code is: #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h&...
0
votes
1answer
271 views

Pset4 Recover not working

I am working on pset4's recover. My variable, outptr, is not being recognized by other parts of my do-while loop. Why is this? #include <stdio.h> #include <stdlib.h> #include "...
0
votes
2answers
285 views

Pset4 | Recover | problem in finding first Jpeg

I'm a bit stuck with my code. I guess the logic is correct, but the program doesn't give me any output and I have to kill it. Debug is showing me, that the problem is somewhere in checking, if the ...
0
votes
2answers
242 views

Pset 4 Recover Corrupted JPEG

I'm doing recover on pset4. The program creates 50 images with their proper names but their contents turn out weird, misaligned and corrupted. Looking at my code and the images, I suspect the problem ...
0
votes
1answer
92 views

My code recovers every image but is still not passing check50. It seems like i am missing some data in my jpegs, but i can't understand why that is

int main(int argc, char *argv[]) { //ensure proper usage if (argc != 2) { fprintf(stderr,"Usage: ./recover infile\n"); return 1; } // remember filename char *...
0
votes
1answer
1k views

Pset4 - Recover (usage of sprintf)

When I am working on Pset4 - Recover, I realize I do not understand the concept of array and pointer. Although I finally worked it out, I would be very grateful if you guys can explain the following: ...
0
votes
1answer
203 views

recover.c unsupported image format after opening

I am trying to recover the deleted files in card.raw (argv[1]) I managed to open the jpeg files in order(001 to 049) but the problem is, when I click on jpg files, the following message show "invalid ...
0
votes
1answer
59 views

PSET4 If statement returns false on recover.c

The if statement given for recover.c for some reason keeps returning false and I'm not sure exactly what I'm doing wrong here. ---
0
votes
1answer
136 views

pset4 recover check50 2016.recover recover.c shows 000.jpg correct but middle and last incorrect

I have run my program several times and it outputs all 50 images and all of them open correctly and look fine (000 to 049). But the check50 says that: :) recover.c exists :) recover.c compiles :) ...
0
votes
2answers
45 views

Some comprehension questions now that I've fixed my code

So i struggled probably a little less than some did with recover.c, and was able to fix my problems with the help of other's questions on this stackexchange, but although i was able to get my code ...
0
votes
1answer
35 views

compilation errors in recover.c pset4

here is the link to my code I don't understand the reasons for the errors in compiling: https://pastebin.com/KhrWPKec
0
votes
1answer
142 views

pset4 recover-Can't figure out how to proceed

This is the code I've been able to figure out. I really don't know how to procced further. Any help would be much appreciated. #include<stdio.h> #include<cs50.h> #include<string.h> ...
0
votes
0answers
58 views

CS50 recover problem with junk data

EDIT: Okay, I appear to have found the problem. I was actually opening the file pointer when I declared FILE *outptr, instead of setting it to NULL. (I should have shown that bit of code...) That said,...
0
votes
1answer
284 views

Having some tough time with pset4 recover.c

I've hit a wall and would appreciate some of you more experienced people to help me through or point me in the right direction. Below is my code, and it generates 27 JPEGs all distorted (numberer 0 - ...
0
votes
1answer
426 views

cs50 pset4 recover.c error: munmap_chunk(): invalid pointer

I have been working on this pset for a while, but I was not able to solve my problem yet. When I compile my recover.c program, it does so without any errors. Although my program creates all images ...
0
votes
1answer
177 views

Pset4 recover.c I'm able to recover all images. But Check50 is not passing

:) recover.c exists :) recover.c compiles :) handles lack of forensic image :) recovers 000.jpg correctly :( recovers middle files correctly :( recovers last file correctly I am able to see all 50 ...
0
votes
1answer
183 views

Recover segmentation fault :(

#include <stdio.h> #include <cs50.h> #include <stdint.h> char filename[10]; int count=0; int main(int argc, char* argv[]) { //checking for proper usage if (argc !=2) { ...
0
votes
1answer
82 views

Recover seems to be recovering incomplete or illegible images

Not sure of what is wrong with my code logic #include <cs50.h> #include <stdio.h> #include <stdbool.h> #include <stdint.h> typedef uint8_t BYTE; // define a function to ...
0
votes
1answer
307 views

Recovering JPEGs fails Check50 CS50 pset4

What it has to do: Iterate through each block of 512 bytes in input file. When found JPEG header, assuming that it is start of JPEG write it to a separate file, continue until new header is found, ...
1
vote
1answer
527 views

CS50 pset4 recover: buffer type and fseek questions

I have figured out a solution to recover, but my first attempt did not work. I'd like to understand a couple of things from my original attempt so I don't repeat the same errors in future code. ...
0
votes
1answer
159 views

[PSET4][Recover] Why does FILE* img work but not FILE *img?

A little background first: I really enjoyed figuring out recover.c. After finishing the successfully once, I wanted to cement the concepts in my head, so I rewrote it from scratch as best I could, ...
0
votes
1answer
902 views

recover.c Invalid or Unsupported Image Format

I wrote the code that logically I think should be working, it creates 50 images, however if I try to open any of them, it says Invalid or Unsupported Image Format also when I tested it with ...
0
votes
1answer
2k views

PSET 4: load of null pointer of type 'BYTE' (aka 'unsigned char')

I get a segmentation fault, specifically: load of null pointer of type 'BYTE' (aka 'unsigned char')' error when I try to compile my code. Any assistance is kindly appreciated. #include <stdio....
0
votes
1answer
31 views

PSET4 Recover - why does the order of these matter?

I have come up with a working code for this problem but I spent hours debugging to find out the main issue I had was the order of some variables. Please explain to me why the order matters and why ...
1
vote
1answer
687 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 ...

1
7 8
9
10 11
18