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

PSET4 Recover: parentheses and order of operation && ||

I was wondering if you could use parentheses to group logical and/or "&& ||". I am writing up the part where I check if the file block is a jpeg and having saved the 512 byte array. I check: ...
1
vote
1answer
233 views

When I run my Recover program, it only recovers 3 of the images

Here is my code for recover.c. It compiles and runs fine, but can only retrieve three out of the sixteen images. I'm not quite sure why it does this. // Sorry about the formatting of the top part! ...
0
votes
1answer
95 views

Pset 4 Recover: Stuck, the program only recover 13 pics

Here's my code: int main(int argc, char* argv[]) { FILE* card = fopen("card.raw", "r"); if (card == NULL) { printf ("File doesn't exist"); return 1; } uint8_t ...
0
votes
1answer
82 views

pset4 Recover Cant figure out why jpeg file pointer gets reset to NULL.

Using Error messages and gdb I figured out why I wasnt getting segfaults- img pointer - to the current jpeg file gets set to NULL. Are my loops all wrong? Im getting myself pretty confused. Code ...
0
votes
1answer
180 views

hi every one. can any one help me please:( in recover pset4 when run this code gives [could not create (null)]

typedef uint8_t BYTE; int main(int argc, char* argv[]) { // TODO // open input file FILE* inptr = fopen("card.raw", "r"); if (inptr == NULL) { printf("Could not open.\n"); ...
0
votes
1answer
113 views

Why doesn't my recover program find any images?

My program runs and it seems like nothing happens. I added a printf statement to show the current position in the infile. It updates and shows that its reading the memory card but never finds a jpg ...
0
votes
1answer
82 views

Recover from getting 8 images to now just 1 image and terminal hanging

Ok now for the last 48 hours I have been trying to make recover work. First I made a program that got only 8 correct images. I posted my problem in this link and got a response and understood how my ...
0
votes
1answer
185 views

Recover first 8 images but no Cosecutive freads

I have just spend hours trying to figure out why my program is giving out only 8 images (correct) instead of 15.Checked on the forums there were similar problems and the solution that I understood was ...
0
votes
1answer
127 views

pset4: recover.c

My code creates 16 jpgs, with the correct naming as well, but they all start with the wrong bytes and I can't figure it out...; int main(int argc, char* argv[]) { // open card file FILE* inptr = ...
0
votes
1answer
87 views

Recover Only First picture correct out of 11 generated

ok I have been looking into this problem for some time now and cant understand what the problem is, My recover.c is creating only first 11 jpegs and only the first one is correct. Any help would be ...
0
votes
1answer
87 views

Got 0.0 only on the part of recover 015.jpg. Don't understand why

/** * recover.c * * Computer Science 50 * Problem Set 4 * * Recovers JPEGs from a forensic image. */ #include <stdio.h> #include <stdint.h> #include <stdlib.h> //function doesn't ...
2
votes
1answer
1k views

Recover where to start from?

I finished resize after spending days on it and took a week break, today I read what recover is and after reading it I am having that feeling as to what to do where to start from? Have spend like ours ...
1
vote
1answer
80 views

pset4 recover cant find headers

I just started on this code and for now I ONLY want to find the headers. Why doesnt this code find any? It seems to me it looks for blocks and then compares the first 4 bytes.. #include <stdio.h&...
0
votes
1answer
122 views

Why does my recover seem to work correctly but fail check50's tests?

Recover perfectly recovers all 16 jpgs, but fails the last 3 checks in check50. https://sandbox.cs50.net/checks/d8b30ce483964703917dc0153b9d0d2e #include <stdio.h> #include <stdint.h> #...
0
votes
1answer
65 views

pset4 recover can't make any jpg

I have had some segmentation fault and errors in this code before that was fixed with you guys help (thanks Cliff B!). After fixing everything that I could, and thinking that everything now makes ...
0
votes
1answer
157 views

Segmentation fault pset4 recover.c

I am stuck with a segmentation fault after finishing up the code for recover.c. I have read the code over a few times but it seems to make sense to me... So I can't really tell what I'm doing wrong. I ...
0
votes
1answer
785 views

pset4 recover invalid or unsupported Image format

i thought i got the main idea with my pseudocode and actually it opens the exact amount of files in the "card.raw" but when i try to open them none of them opens and gives "invalid or unsupported ...
0
votes
1answer
185 views

pset4 recover: reading from infile

It compiles. But if I step into this function: fread(&pos, sizeof(BYTE), 1, file); I get an error from GDB: _GI_IO_fread (buf=0xbfffff0d, size=1, count=1, fp=0x804b008) at iofread.c:35 iofread.c:...
1
vote
1answer
112 views

Pset4 Recover: Not understanding where to put the forever loop to break out and close the image file

My code for recover.c works except for 015.jpg. I can see the image in the folder, but the file is not closing correctly and thus disrupting check50. I get that I want to put a "forever loop" ...
0
votes
1answer
154 views

recover segmentation fault fclose

I need your help again. Something wrong with my fclose in both cases (as valgrind said). The program compiles, but it has segmentation fault and doesn't create jpgs. Here is the code (sorry for ...
0
votes
1answer
614 views

Why can't my recover program open card.raw?

card.raw is in the same folder as my recover program. When I try to execute it, my program spits back to me "file could not be opened" which is what I programmed it to do if the file pointer returns ...
-1
votes
1answer
138 views

Recover seems to work fine but check50 disagrees

My program seems to function correctly, but check50 disagrees. Can anyone please tell me why? Thank you in advance! #include <stdio.h> #include <stdlib.h> #include <cs50.h> #include ...
0
votes
1answer
114 views

pset4 Recover - only recovers first 8 images

My program restores 16 images but only the first 8 seems to be in the right format. The size of the eight images that have not been restored successfully are all 1024 bytes. Any help would be really ...
0
votes
1answer
2k views

recover.c how to find beginning of next jpeg

So far, I have managed to find the byte-sequence that a block in the .jpeg file starts with. Now I don't know how to tell the program to stop at the next such block. Moreover, I don't know how I ...
0
votes
2answers
85 views

In recover.c, how do you name each image file a seperate name?

Is this even necessary? Will the computer automatically name each file? Or will it use the name designated in fopen()?
0
votes
1answer
83 views

My program won't end!!!! PSet4 recover

My program won't end and I don't know why. int counter = 0; FILE* inptr = fopen("card.raw", "r"); BYTE compare[512]; fread(&compare, 512, 1, inptr); while(!feof(inptr)) { if ((compare[0] == ...
0
votes
1answer
437 views

recover.c; don't know how to find the first 4 bytes

Below is my code. It doesn't even compile, because I get the following error: "passing 'unsigned char [512]' to parameter of type 'char *' converts between pointers to integer types with different ...
0
votes
1answer
155 views

Recover.c problem

I have been working on the recover.c part of pset4. While it took me a while, I feel I have the code figured out. While my method is different from that of some other people, I feel it is correct. ...
0
votes
2answers
479 views

Segmentation fault - pset4 recover

Can I get help with this "recover" code? I keep getting a segmentation fault and I can't understand why! It's coming from the second condition (where it's written segmentation fault) in the below code ...
0
votes
1answer
525 views

Recover Works, but Check50 “killed by server”

My recover program recovers 15 jpg files, 000.jpg through 015.jpg. All files open without issue. However, check50 fails :) recover.c exists :) recover.c compiles :( recovers 000.jpg correctly :( ...
0
votes
1answer
727 views

Recover, SOS before SOF

I have done my pset4 recover program, it seems to work, recovers 16 pictures and 15 of them are all right, but the first one is incorrect, and it says "Error interpreting JPEG image file (Invalid JPEG ...
0
votes
1answer
115 views

Segmentation fault in pset4 recover in the first call to fread

The program crashes in the first time fread is called I tracked it with gdb, This is the error: Program received signal SIGSEGV, Segmentation fault. __GI__IO_fread (buf=0xbfffeedc, ...
0
votes
1answer
211 views

PSET4 recover, segmentation fault

I found with Valgrind that in my code line 79 there is a segmentation fault in the fwrite function, but I can't find the reason why that is. So after 6 straight hours I thought that some help might be ...
0
votes
2answers
144 views

PSET4 recover see thumbnails but no picture

When I finished pset4, I submitted it but received a 0 on recover. Before submitting, it was working correctly: I saw all 16 pictures (Maybe I accidentally changed something just before submitting..) ...
0
votes
2answers
267 views

PSET4 Recover Problem to repair .jpg's signature in hexadecimal

I'm not sure if I use correctly the hexadecimal notation to verify if there is a .jpeg signature in the beginning of my BLOCK of 512 bytes. My program compile well but no photograph is revealed. May ...
0
votes
1answer
74 views

How can I avoid a Segmentation fault in my Recover.c

I have looked thoroughly through other solutions, but they tend to be specific to another person's code. I have also used Valgrind to try and isolate the problem, and considered that I may have to use ...
0
votes
1answer
110 views

pset4 recover.c sge fault cant find first jpg signature

Here is my code. I keep getting a segmentation fault while iterating over beginning of bufferArray[512] looking for the first jpg signature. Please help! I cant see what i've done wrong. Im trying to ...
0
votes
0answers
83 views

pset4 recover creating small jpgs

#include "stdio.h" #include "cs50.h" #include "stdint.h" int main(int argc, char* argv[]) { // check for command-line arguments if (argc >= 2) { printf("This program does not accept command-...
0
votes
1answer
107 views

Is there a more elegant way than this to search for the start of a jpeg? (pset4 recover.c)

// start of new jpeg? if (buffer[0] == 0xff && buffer[1] == 0xd8 && buffer[2] == 0xff && (buffer[3] == 0xe0 || buffer[3] == 0xe1)) There must be, because this ...
0
votes
1answer
578 views

Pset4 recover help

int counter = 0; FILE* inptr = fopen("card.raw", "r"); BYTE compare[512]; fread(&compare, 512, 1, inptr); while (!feof(inptr)) { if ((compare[0] == 0xff) && (compare[1] == 0xd8) &&...
0
votes
1answer
147 views

Corrupted jpeg's

It all seems in order, expect that when i try to open the jpg, the image viewer complains that a jpeg should start with "0xff" and not "0x00". I have no idea what i am doing wrong here! If you could ...
0
votes
0answers
165 views

Recover finds first jpeg then never finds the next

The code compiles and using GDB I can look at the block data and see the jpeg pattern matches for the first jpeg(I'm assuming it's the first.) The second do loop to pack the jpeg file with data until ...
0
votes
2answers
172 views

Pset 4 Recover: Image pointer returns null on second iteration of code

For some reason my code seems to be either unassigning the pointer to my image when it reaches the second iteration following the opening of the first jpg file. (I know this because there is a ...
0
votes
1answer
110 views

recover compile error

I am stuck with my recover code. The compiler yells at me because I am doing a incompatible pointer to integer conversion but I can't see where... recover.c:28:18: error: passing 'BYTE [512]' to ...
0
votes
1answer
386 views

Pset4 - Recover - Baby Step - trying to create and write 1st Jpg

I am trying to ease into this pset and am having difficulty starting with the first step - locate 1st jpg, create and write. I think that once I have that figured out, I'll have an easier time ...
0
votes
1answer
133 views

Recover.c memory error

I have been having trouble getting my program to free memory correctly. I believe the problem occurs when I try and free the memory of the block array. I figured out how to free the memory for the ...
0
votes
1answer
564 views

recovering 15 images out of 16

i have spent some time looking and trying all that i can to make sure i get the 16 pictures from the file given but am only able to recover 15, any help will be appreciated. my code is: typedef ...
0
votes
1answer
140 views

Getting wrong information from card.raw PSET4?

I have been trying to figure out what has been the problem now for a while but I can't. When I run GDB, it is telling me that compare[0] is either 97, 235, 82 or 0. int counter = 0; FILE* inptr = ...
2
votes
1answer
1k views

pset4 recover I'm confused with fread

I'm pretty confused with recover. I've seen in previous posts that it is wrong to use feof , but the problem is that when I use fread the images won't show. However, when I use feof I can see all ...
0
votes
1answer
129 views

Recover.c successfully recovers several photos before a segmentation fault

I read several questions related to the segmentation fault but still cannot figure out what exactly is wrong with my code. Basically, what happens is that the program recovers around 10 photos ...