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
1answer
1k views

What is the difference in behavior between fread and feof?

For pset4's recover.c code, I noticed the following: when I set my while loop to be while (!feof(inptr)), all the images get recovered, including the last, but check50 throws an error (TODO) when ...
0
votes
1answer
179 views

pset 6 server - Load produces inconsistent results

I'm really confused about what is wrong with my code as load works for certain files but not others and the reading of the file isn't something that is altered in any of the functions we're tasked ...
0
votes
2answers
413 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 ...
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?
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 ...
2
votes
2answers
626 views

Pset4 recover, comparing hex in if statements

I'm trying to solve "recover" but, I'm unable to compare my if statements. This is my error message: error: comparison of constant 224 with expression of type 'char' is always false [-...
1
vote
1answer
199 views

Pset4 recover: can't seem to use struct to identify the jpg

Trying to apply the structs from pset4/resize. Coming up with a quick prototype to make sure i understand structs completely. 1) I keep returning nothing in my output. Can someone tell me what's ...
1
vote
1answer
632 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 "...
0
votes
1answer
130 views

Can I create an element of arbitrary size in a STRUCT?

I'm working on recover.c. It seems like a tidy solution to eliminate fseek calls would be to create a struct like the following: typedef struct { BYTE first; BYTE second; BYTE third; ...
0
votes
2answers
2k views

PSET 4 Recover Help with reading 512 byte blocks.

I'm having some trouble trying to read and loop through the card.raw file. I'm not running into any errors though I can't figure out why when I call fread I continually get 0 as a return value. My ...
0
votes
2answers
202 views

PSET4 RECOVER Can't Open JPEGS, I Have Tried Everything Please HELP!

so this is my second time posting about this pset, my code is below. No images will open, with the current code. However when I do get something to open it is just 1 file and it says invalid or ...
2
votes
2answers
262 views

pset4 recover: recovered images seems to still be corrupted

My code compiles and runs without any errors. Images are generated, but the images are incomplete, here's an example of 000.jpg: https://i.imgur.com/Ovs2Xv8.png. I can't really find what's wrong in my ...
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 ...
1
vote
2answers
1k views

pset4 recover: last image not recovered correctly

My program does return all 50 jpegs, check50 says that the last file is not recovered correctly. Unfortunately, I have no idea of why - I check for the end of the file before reading new data into the ...
1
vote
0answers
360 views

Anyone get rick rolled in recover.c? [closed]

Did anyone get the easter egg while working recover.c? If you open the card.raw file for reading, and then: char block[512] = {0}; fread(block, sizeof(char), 512, inptr); which is incorrect, but ...
1
vote
1answer
893 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/...
1
vote
2answers
99 views

Pset4 recover.c compiles, but can't seem to print Jpgs at all

Am starting a new thread as I'm having trouble understanding what is wrong with the code.. I've added printf statements at the jpgCheck function and did not get a print. I suspect it's the function? ...
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 ...
1
vote
1answer
876 views

Correct use of fopen, fclose, file pointers

I found this problem while working on recover.c. My program recovers all the image files, check50 says everything's cool, but when I run Valgrind, it gives me a ton of errors. After some tests, I ...
0
votes
1answer
121 views

Pset4 Recover conceptually struggling

Pset4 Recover is different since it uses files; fopen, fcloser, fprintf, and fread. It adds a whole new dimension to the coding. Its change from just formatting conceptions to making sure all the ...
0
votes
1answer
29 views

CS50 Pset4 Logic Problem

I am 3 days into PSET 4 Recover. In PSET 4 we are supposed to create a program which inputs a memory card and scans through that memory card for the signatures of lost JPEG files. Once the header of a ...
0
votes
1answer
61 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
47 views

CS50 Recover JPG's not rendering correctly

My code is recovering 50 images, but according to check50 the images are not being recovered correctly. A few of the images are obviously not recovering but I can't figure out why in my code. Several ...
0
votes
0answers
39 views

recover.c spits out images that are partially recognizable

recover.c compiles and runs normally, but it produces 21 images that have chunks of different images mixed in. Here are the images: 000.jpg: 001.jpg: 002.jpg: 003.jpg: 004.jpg: Because I'm too ...
0
votes
2answers
788 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
370 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
135 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
210 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
107 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....
0
votes
2answers
256 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
55 views

Recover not returning images

I've been itching at this code for hours now, it doesn't output any images, everytime i try to debug it it comes to the first while statement and immediatly returns 0, i have no idea why int main(int ...
0
votes
1answer
245 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
17k 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 ...
0
votes
1answer
332 views

why does my recover find only 8 JPGs?

The recovered images are fine, and when comparing the recovered images with the images in card.raw using xxd, I see that they're not the first 8 images on the card. Some of the recovered images ...
0
votes
1answer
546 views

Trouble Compiling, Comparison between Pointer and Integer?

I'm having trouble compiling my recover.c code as the compiler is telling me that I'm trying to compare an integer to a pointer? This is referring to the check to see if the first characters in the ...
0
votes
1answer
174 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 ...