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
1
vote
2answers
651 views

check50 says “bmp.h” not found even though “bmp.h” is in jpg directory

Hello all I have a question about compiling what I've written for recover.c The compiler shows me this message when I try to compile recover: " expected an exit code of 0, not standard error of ...
0
votes
1answer
267 views

pset5 recover creates 50 corrupted images

I seem to have in issue writing data inside my loop, so that 50 JPGs are created with only 1 block of content each. I am checking for the beginning of a new JPG, and open a new output file inside that ...
2
votes
1answer
323 views

Recover creates an unreadable image file and then segfaults

I am pulling my hair out over recover.c in pset5. My code manages to generate 1 appropriately named (but unreadable) jpg and then fails with segmentation fault. I have tried to figure it out by ...
0
votes
1answer
83 views

Do CS50x students need to take part in the contest in pset5?

After the Computer Science Investigation (CSI), there is a contest about taking pictures with CS50 staff. See the link: http://youtu.be/Y4vV61lbL3g?t=9m23s
0
votes
2answers
581 views

recover all the images as expected but fails check50 last 3 tests

I recovers all the 50 images and check my program correctness through check50. but it fails last three test can you check my code and tell me where i'm wrong here's the check50 error :) recover.c ...
0
votes
2answers
240 views

Seg fault in recover.c pset5

I don't know why it's showing seg fault. Could anyone please tell me what I've done wrong? #include<stdio.h> #include<stdint.h> #include<stdlib.h> typedef uint8_t BYTE; ...
0
votes
2answers
21k views

How to create an array/subarray by extracting a part of another array?

Does anyone know how one can create a subarray by extracting a part of an existing array. Is there something like subarray[] =existingArray[0-3]? I need this to compare the first 4 bytes of my block ...
-1
votes
1answer
170 views

How to read the next sector in recover?

Below is the code that i have written when i execute the code i get jpg images but they are corrupted.Any help regarding it? //reading the sector and checking the condition do { fread(from ...
0
votes
1answer
478 views

Error: double free or corruption when running recover

After a very long time, I finally managed to find out why my version of recover.c only managed to recover 1 image (recover.c only recovers 1 image) Anyway, now I face a new problem. What I've ...
0
votes
1answer
572 views

recover returns corrupted images

I'm currently writing recover.c for pset5 last exercise. The program I designed runs ok, outputs the expected amount of JPGs at what I would expect to be reasonable sizes. However the JPGs are broken ...
0
votes
2answers
804 views

recover.c only recovers 1 image

I'm having a problem with my code for recover.c because it recovers only 1 JPEG and that JPEG isn't a JPEG. It starts with 0x68 and 0x74. After going through the code with GDB, it seems as that on ...
0
votes
1answer
373 views

Recover pset5 scope?

I'm almost there, but one more question about recover.. In my code, I open a file inside an if condition, but how do I acces that file later? It's getting out of scope and I'm getting use of ...
0
votes
1answer
325 views

pset 5 Recover check if file open

How do I check if I already opened a jpeg file to write to? I could declare an int outside of the loop that I set to 1 if I open a file, but I think there must be another way... Some kind of function ...
1
vote
1answer
633 views

Recover creates the pictures, able to view them, but listed as jpg? in ls and check50 fails

I checked the boards and couldn't find if anyone else had the same issue. For some reason, Recover runs 'seemingly' correctly when I ask it to and I see the pictures in the folder from "000.jpg" to "...
1
vote
1answer
2k views

recover end of file detection

I'm having a lot of trouble with recover. I have written some code, just to get the basic structure. I was trying to iterate over the raw file until the end, printing when stumbled upon a jpeg. ...
4
votes
1answer
3k views

What data structure do you use to store the buffer in recover?

What data structure do I use to store the 512B blocks in a buffer? Thinking about an array or ints? Or am I completely off?
2
votes
1answer
1k views

Can't recover 049.jpg successfully

The 049.jpg file is created but not recovered! I have used the fread function to detect the EOF as told in the walk through by Zamyla. Here is a link to the check50 sandbox output. # Checks 0 ...
0
votes
1answer
135 views

JPEG output files are blank

All of my program seems to be functioning but my JPEG images are completely blank. I'm not sure, but I think the error is somewhere in this code: if ((buffer[0] == 0xFF) && (buffer[1] == 0xD8)...
0
votes
1answer
651 views

pset5 recover error with jpeg file

I keep getting "error interpreting jpeg image file (Not a jpeg file: starts with 0x00 0xd8)", even though gdb tells me buffer[0] is 0xff. A similar question has been posted on reddit, but I couldn't ...
1
vote
1answer
118 views

Can anyone tell why is this giving me a SEGFAULT?

typedef uint8_t BYTE; int main(void) { FILE* memcard = fopen("card.raw", "r"); if (memcard == NULL) { printf("something went wrong and file could not be opened"); return ...
0
votes
1answer
776 views

Seg Fault in Recover.c

I cannot seem to get to get rid of this seg fault. In my loop I basically have this (semi-pseudo code): fread(in); if(nf == 0xffd8ffe0 || nf == 0xffd8ffe1) { f++; fclose(out); ...
1
vote
1answer
869 views

Pset 5 - Recover

Having problems with recover (pset5) now. This is what I'm doing: Opening File Until the end of file Reading 512 bytes to buffer Checking first 4 bytes of buffer to see if a jpg has just ...
1
vote
1answer
377 views

Recover.c Segmentation Fault

Pseudocode: declare counter declare filename[8] main Open input Declare buffer do read(512 bytes into buffer from input) while (not start of jpeg) do write filename open ...
0
votes
1answer
1k views

segmentation fault - pset5 recover.c

I have spent a long time looking through my code for a segmentation fault, but have not been able to find it. #include <stdio.h> #include <stdlib.h> #include <stdint.h> #define ...
1
vote
1answer
3k views

Cannot figure out what is wrong with recover - “Improper call to JPEG library in state 201”

Does anyone know why I might be receiving this error in my recover program? I've used xxd to confirm that the first four bytes are correct and signal that each is a jpeg. However, I am still receiving ...
1
vote
2answers
176 views

Trouble incrementing the number in jpeg filenames

I've gotten recover to work... sort of. The problem is difficult to describe without posting my code, but here's an attempt: My program can find all the jpg signatures (in GDB, my jpeg-finding line ...
3
votes
3answers
963 views

Proper use of fread function

I have declared a buffer as follows : unsigned int buffer[512]; Now, later on in my code I used fread in the following manner fread(buffer, 512, 1, infile) and everything worked as expected. Note ...
0
votes
1answer
72 views

How on Earth can this variable change without any commands? Please help!

As you can see, the value of buffer[0] changes when the line sprintf(tittle, %03d.jpg", images);, which has nothing to do with the buffer. All of the values in buffer are changed. I went through my ...
2
votes
2answers
409 views

Is it possible to see the actual bytes of card.raw?

Is it possible to see the actual bytes of card.raw from pset5?
1
vote
1answer
120 views

Why is this condition true if the characters in the buffer do not match?

As you can see, the if statement on the line 35 is false. Why is the body of the if statement being executed?
1
vote
2answers
180 views

How to build a “.raw ” image of a storage media?

In pset 5 David gave us his SD card's card.raw file to recover deleted JPEG images from. What are these .raw disk images and how can we build them to create practice problems similar to pset 5 for ...
-1
votes
3answers
330 views

Why Doesn't check50 Recognize My Recovered Images?

when I use check50 to check my recover program for pset 5, it says that the pictures are not recovered, but when I look in the file directory, all of the 50 pictures are perfectly recovered. How could ...
0
votes
1answer
595 views

recover.c recovers all images successfully, but check50 says it fails to recover the last. Any ideas why this is happening?

I have a while (!feof(infile)) loop, so that exits only when the eof is reached. And it closes all files upon exit. Here's the code: // scan input file while (!feof(infile)) { // read four bytes ...

1
14 15 16 17
18