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
3answers
406 views

Pset 4 recover same thing, again

/** * recover.c * * Computer Science 50 * Problem Set 4 * * Recovers JPEGs from a forensic image. */ #include <stdlib.h> #include <stdio.h> #include <stdint.h> typedef ...
0
votes
1answer
129 views

Pset4 - recover. It compiles, and makes the files, but there are nothing on them

#include <stdio.h> #include <stdlib.h> #include <stdint.h> #define infile "card.raw" int main(int argc, char* argv[]) { uint8_t buffer[512]; uint8_t startcheck1[4] = {0xff,...
0
votes
2answers
92 views

Besides the do while loop, why couldn't this work?

I have been trying to think of a way to also use for loop in addition to the do while loop version. I feel logically it could work, however there might be a lot of implementations that are bad and I ...
0
votes
1answer
87 views

Pset4 recover, it just freezes, nothing's happening

/** * recover.c * * Computer Science 50 * Problem Set 4 * * Recovers JPEGs from a forensic image. */ #include <stdlib.h> #include <stdio.h> int main(int argc, char* argv[]) { ...
0
votes
1answer
451 views

Recover Segmentation Fault

I have been struggling with recover in pset4. The program compiles and it seems like the code should work, but I get one .jpg file with no information in it. I also get a segmentation fault. I've ...
0
votes
1answer
120 views

Recovering an extra two empty photos

I've written the program (recover.c) and run it. All 16 photos have been recovered, however the entire jpg folder contains 18 photos, two of which (000 and 009) are empty. I've looked through my code ...
0
votes
1answer
107 views

recovery pset4 3 problems

I have problems with this - first, even though the string is correctly formatted it doesn't keep the leading zeros when it names the file (i checked with gdb and printf). Secondly, for some reason, I ...
0
votes
1answer
346 views

Recover pset not delivering expected exit code of 0

Problem Statement: All the jpgs are rendered correctly however I get the following error when I run the cs50check. Expecting an error code of 0 but received the following on standard error instead — /...
0
votes
1answer
318 views

pset4 recover - segmentation fault

i am really confused as to why i get segmentation fault with valgrind on this. It recovers all the photos and returns check50 with green smiley faces but there is something wrong with the code, would ...
0
votes
1answer
5k views

Error message “double free or corruption(top)” in recover.c

I redesigned my code but now I get the following error message: Error in ./recover: double free or corruption (top) Can you help what's wrong? #include <stdio.h> #include <stdlib.h> #...
0
votes
1answer
209 views

Recover only creates 8 JPG files [duplicate]

I've been struggling with this for a long time and it only creates 8 out of 16 images. Can you point me to the error(s)? Thanks. typedef uint8_t BYTE; int main(int argc, char* argv[]) { // ensure ...
0
votes
2answers
320 views

pset4: what does check50 “TODO” error mean?

I am able to successful save and view the files from the card.raw for PSET4, however the check50 is giving me sad faces for recovers 000.jpg correctly and recovers 001.jpg through 014.jpg correctly. ...
0
votes
1answer
529 views

PSET4 recover.c - don't know what's wrong

check50 reverts with following results and don't quite understand what these referring to: :) recover.c exists :( recover.c compiles \ expected an exit code of 0, not standard error of "recover.c:...
0
votes
1answer
102 views

1st image works, but the rest don't work (although thumbnails show up on several of them)

After several (full) days of trying to figure this out, I've hit a wall with this one. My program saves 16 jpgs of various sizes, all properly named. The first opens, then for the rest I get a ...
1
vote
1answer
171 views

recover.c not finding any jpegs

Alright so for fun, I decided to try something a little different in my code. I created a union containing a 32-bit int and a struct containing four unsigned chars. I then read the first four bytes of ...
0
votes
1answer
148 views

Recover.c- better implementation?

So the do/while loop is infinite, as I have been told before. Is there a better way to implement this loop? typedef uint8_t BYTE; int main(void) { FILE* file = fopen("card.raw", "r"); if (file == ...
0
votes
1answer
100 views

Recover.c- killed by CS50

I'm not sure what I'm doing wrong here. I wait until the first jpg is reached, then I make new files until the end of the file. This is btw a very difficult assignment!!! check50 says it complies but ...
0
votes
1answer
4k views

segmentation fault in recover

So my problem is that I get a segmentation fault when I run this code and I'm totally unsure why. I don't really understand what is happening in gdb either. This is definitely the most challenging ...
0
votes
1answer
80 views

pset4: recover.c Why doesn't this work? It always “finds” 0 jpgs (There should be 16)

int tmp; //read from the file to tmp (int) while(fread(&tmp, 1, 1, inptr) == 1){ // if tmp is the first byte of jpg if(tmp == 0xff){ // if it can be read again ...
0
votes
1answer
125 views

pset4 recover.c signature not written correct

I am using the code below for pset4 recover.c. I can see nothing wrong in this code. The code writes 16 jpgs but none of them is open able. The header of jpg files doesn't seem to have been written ...
0
votes
1answer
98 views

pset4, recover. size of hexadecimal 1 bit?

I don't understand something. In recover, to store the card data, I've used a buffer which is an array of 512 BYTES(i.e. uint8_t). In (almost) every element of the array is stored an hexadecimal ...
0
votes
1answer
165 views

Pset4, check50 correct, but grade 0

i am really confused as to why i am getting 0 in my gradebook for recovery. It recovers all the photos and returns check50 with green smiley faces. I don't know what to fix it there is no problems ...
2
votes
1answer
247 views

my pset4 recover grading is 0

my pset4 recover grading is 0. However comment shows all the images recovered successfully. How can I get my grades corrected. Also, all images recovered successfully on my cs50 applaince. check50 ...
0
votes
1answer
133 views

recover.c seg faulting?

My program is seg faulting so impressively that it managed to crash the appliance at one point, and after two days I still can't figure out what's happenning. Help will be massively appreciated at ...
0
votes
1answer
282 views

pset 4 - recover - Segmentation fault reading into buffer

My program makes one image, then has a segmentation fault. Using GDB, I can see that the segmentation fault happens on the next iteration of the loop after creating the first jpeg. Looking more, I ...
0
votes
1answer
471 views

Naming files in recover.c?

I just wanted to check whether my reasoning with this is correct. We use fopen to start a new file once we start the beginning of a new jpeg, and use the "w" (write) mode, right? And then we need to ...
0
votes
1answer
245 views

pset4 recover.c seg fault

In my pseudo code this is what this will do(I made FILE* img a prototype also counter = 0 and newcounter is 2 initially ) read the first 512 bytes check if the header is in it if it is say found one. ...
0
votes
1answer
176 views

#pset4, #recover.c

My code recover 12 files. first one is opening, rest are not. What is wrong with the code? #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> ...
0
votes
1answer
56 views

Pset4: recover.c — quitting early without error

I have written the following code to read the information from the RAW file and try to sort it out into the proper jpeg files. Through gdb, I can see that the file is reading into the buffer fine (...
0
votes
1answer
576 views

#pset4 #recover.c segmentation fault

What is wrong with my code? The error says "segmentation fault core dumped" #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> typedef uint8_t ...
0
votes
1answer
462 views

pset4 recover.c. I have no clue on how to start

I get how to solve it. I have the pseudocode in mind on how to solve it. But i cannot understand how do I go about solving it though because I cannot address the most fundamental problem. How do I go ...
1
vote
1answer
150 views

Recover.c Nothing Happens!

I run my code which seems right to me but nothing happens! No images appear in my jpeg file!! Please help me I am stuck. Thank you [code hidden to comply to academic honesty] // Checks if file is ...
0
votes
1answer
70 views

Segmentation fault error for recover.c

I've been getting segmentation fault errors but i don't know why. I've made sure all our files are opened and closed, made sure nothing "left out" but i still can't get it to work. this seg fault ...
0
votes
2answers
416 views

Developing JPEGS for pset4's recover troubleshooting

I am currently working on cs50's pset4 recover. I have managed to compile the program. However, when run, the images are corrupt and apparently, according to image viewer, are not jpeg files, because ...
0
votes
1answer
21 views

Which extension to use?

In pset4's recover, which file extension to use for JPEG images. jpeg or jpg? What's the difference and will it make some difference on output?
0
votes
1answer
103 views

pset 4; Recover - Searching for ffd8ffe0 and storing hexidecimal numbers

I'm working on a portion of the Recover project and was wondering if there is a more elegant solution eluding me. I've noticed that when I come across the first JPEG which starts with ffd8ffe0 gdb ...
0
votes
1answer
121 views

Persistent segmentation fault on pset 4 (recover.c)

I have a segmentation fault that won't go away. Code: /** [mod edit to hide code behind a link] Running gdb, after a few lines, I get an error saying "iofopen.c: No such file or directory." Why is ...
0
votes
1answer
94 views

My code runs, but it creates 15 corrupted images. I've been trying to find the bug(s), but I'm very, very lost. Any ideas on what I'm missing?

#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> int main(void) { uint8_t buffer[512]; FILE* inptr = fopen("card.raw", "r"); if (...
0
votes
1answer
463 views

PSet4 - recover.c generating seg fault

I've been trying to implement recovery algorithm for PSet4. As much as I understand the logic behind it, I'm stuck with the implementation. The problems I'm having: condition if(card == NULL) is ...
0
votes
1answer
250 views

Only recovering 8 images in recover.c

I've looked at other forums on the question but it seems every solution varies based on how someone has written their code. So here's mine. Can someone show me the fault in my program. #include <...
0
votes
0answers
81 views

Error in recover

I'm not to sure if "Aborted (core dumped)" means the same as "Segmentation fault (core dumped)", but that was the error message I received when I executed the program; however when I ran the program ...
0
votes
1answer
51 views

Getting error messsages in pset4's recover

I am not understanding why I am receiving the error messages undeclared identifiers for initializing unsigned char[512] data or FILE* img? I tried using a uint8_t [512] as well, but received the same ...
0
votes
1answer
531 views

fclose in recover causing segmentation fault

I've "finished" my recover.c, but valgrind says about leaks of memory. It seems like i haven't closed all of my opened files. But I have a problem. If I put fclose function in my loop, to close a file,...
0
votes
1answer
315 views

I'm lost on how to start pset4's recover.c

I understand the concept of pset4's task, which to uncover a series of JPEG's on a so called "CF" card, but I am clueless on how to get this program going, nonetheless started.... I don't want to look ...
0
votes
1answer
188 views

Need help with “recover”

I can't figure out what's wrong with my code. File names are created successfully but all jpegs just show the corrupt thumbnail. I'm sure it has something to do with finding the start and end of the ...
0
votes
1answer
365 views

pset4 - recover — File does not produce jpegs but I don't know why

I am stuck. It compiles but doesn't produce the jpegs. Any insight please? int main(void) { // open file for reading FILE* file = fopen("card.raw", "r"); // Open the file for reading // ...
0
votes
2answers
209 views

I don't understand the concept of recover

I dont understand the concept of recover. I tried watching the walkthroughs and it really doesn't make sense. Are you supposed to make your own jpegs or does cs50 provide it. Can someone explain. ...
1
vote
1answer
929 views

pset4 recover works correctly but fails check50

Morning, I have just finished pset4 recover. The program works correctly and I can see all 16 jpgs and they are labeled correctly however check50 is failing:- jharvard@appliance (~/Dropbox/CS50/...
0
votes
1answer
104 views

Pset4 recover problems detecting jpg data

So right now, my code can open the compact flash card and look for jpg headers byte by byte. It tells me that it has found 16 jpg files (which is what I had anticipated). However, my concern is ...
0
votes
1answer
72 views

code on infinte loop: start of a jpg UPDATE

I've some issues with my code, it compiles but it gets stuck in an infinite loop. I've run gdb and apparently it never finds the start of a jpg. here is a snippet:(UPDATE here is the rest of the ...