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
208 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
1answer
92 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
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
202 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. ...
0
votes
1answer
1k views

recover pset4 Why “error interpreting JPEG image: Improper call to JPEG library in state 201 (or 200)”

(int j is just for checking) typedef uint8_t BYTE; typedef struct { BYTE buff[512]; }__attribute__((__packed__)) BUFFER; int main(int argc, char* argv[]) { // open input file FILE* infile = ...
0
votes
1answer
340 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
337 views

check50 fails on “pset4 recover” because of an expected exit code

My recover.c code "works" in that it recovers the 16 images, but check50 is failing as follows: https://sandbox.cs50.net/checks/1b832e85fc5148e28a6ae28f24ff9f80 Any idea what that's happening? For ...
0
votes
1answer
452 views

fread not putting what I expect in buffer

for Pset4, recover, I'm trying to read 4 bytes from card.raw into a buffer. I''m testing the first 4 bytes of card.raw with what my buffer contains using gdb, and I'm not getting the same thing. I ...
0
votes
1answer
138 views

Infinite loop and unable to check for next JPG

My program is stuck in a loop and I can't figure out why. The problem is in the do while loop but logically it should work. The program checks performs fwrite and then freads a new 512 bytes to the ...
0
votes
2answers
578 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
19k 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
570 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
1answer
649 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 ...
0
votes
1answer
775 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); ...
0
votes
1answer
25 views

pset4 - Recover passed check50, but want to understand the logic on fwrite or file-pointer

Below are my code for pset4 - Recover, it passed the check50, but I am trying to understand the logic on a particular process of fwrite or file-pointer. In short, my question is how does line 74 know ...
0
votes
1answer
16 views

The third last line of code is the one causing a segmentation fault. When removed, nothing happens and all I get is a $ on a new line in the terminal

#include <stdio.h> #include <stdlib.h> #include <string.h> #include <cs50.h> int main(int argc, char *argv[]) { #define BUFFER_SIZE 512 FILE *img = NULL; if(argc =...
0
votes
1answer
34 views

Why does `size` = `0` occur?

I've been trying PSet4's Recover. I've been trying to obtain the size of the entered file (card.raw) but unfortunately size gives and output of 0. Here's the code that I've made to find the file's ...
0
votes
1answer
32 views

Pset4 recover getting Segmentation error

#include <stdio.h> #include <stdlib.h> #include <cs50.h> int main(int argc, char *argv[]) { // file opened FILE *file = fopen(argv[1], "r"); // user types two ...
0
votes
1answer
44 views

Recover.c - Code Creates JPG files but it doesn't doesn't match expected output

#include <stdio.h> #include <stdint.h> #include <stdlib.h> typedef uint8_t BYTE; int main(int argc, char *argv[]) { //user didn't enter one argument or enters more than one if (argc &...
0
votes
1answer
38 views

not recovering any JPEGs though the code works

can someone tell me what is wrong with my code it works and recovers but no images are found upon checking :) recover.c exists. :) recover.c compiles. :) handles lack of forensic image :( recovers 000....
0
votes
1answer
49 views

PSET 4 Recover.c - Segmentation fault

The code compiles perfectly. However, it triggers a segmentation fault which I imagine is due to a wrong use of pointers. This is the code: #include <stdio.h> #include <stdlib.h> #...
0
votes
1answer
26 views

Recover used to make files and now doesn't (Spoiler Alert)

It took me a while to figure out why my files wouldn't be created, but eventually, I made a change that did it! I saved and left that session, and when I came back, nothing had changed, but when I ran ...
0
votes
1answer
45 views

CS50 Recover (pset4). Images dont seem to load

my program compiles successfully but it doesn't seem to produce any images at all. I tried using debug50 and it seems like the if condition for buffer[0] through to buffer[3] isn't fulfilled, or the ...
0
votes
1answer
37 views

How can I create a loop to read end of the card.raw file?

I'm using the basic expressions have been taught in the short videos but probably I'm implementing them wrong, especially I believe I'm using the wrong data types for my variables :/ My loop ...
0
votes
1answer
48 views

Recover Week 4 Assignment--Code appears to work beautifully but check50 says no

My code works as I get all 0-49 images that look beautiful to me. After days of working on this, I really would appreciate any advice as to why the checker is saying my code failed the last three ...
0
votes
1answer
35 views

pset4 recover: Not getting as many files as the problem requires

After reading a few submissions for help here and in the subreddit, People have told me there should be 50 files in the memory card. I have made a loop that correctly reads the file, but as soon as I ...
0
votes
1answer
47 views

Pset4 Recovery Produces Corrupt Null Files & Skips An Image

I've been working at recovery for a while - I believe I'm nearly done with it - but right now my code is giving me serious problems. Currently, running ./recover card.raw produces 49 of the 50 images (...
0
votes
1answer
58 views

CS50 PSet4 Recover fails Check50

I'm having trouble finding the issue with my code. It successfully recovers 50 JPEG files 000 - 049 which can all be opened and viewed and seem correct. But my code fails check50. Does anybody have ...
0
votes
1answer
48 views

pset 4 - recover. Can't figure out what is going wrong!

Can't figure out what I'm doing wrong, I've spent like 2 days on it already, please help! #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { if (argc != 2) {...
0
votes
1answer
39 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
57 views

Pset4 Recover Help Understanding What to Do

I am trying to work on Pset4 Recover. I am having trouble understanding exactly what to do. Any help explaning would be appreciated. I have started but I know it's not all right and I know it doesn't ...
0
votes
1answer
24 views

Pset4 Recover Segmentation Fault Issue

I'm having an issue with my code, and I was hoping you could help! I keep getting a segmentation fault error, and I'm not sure why. I've ran valgrind and according to its findings, the issue seems to ...
0
votes
1answer
40 views

Help on Pset4-recover, Segmentation Fault

Here is my code: #include <stdio.h> #include <stdlib.h> #include <stdint.h> //remember: free malloc + fclose files typedef uint8_t BYTE; int main(int argc, char *argv[]) { //...
0
votes
1answer
25 views

Seg Fault in Writing to JPG

I am working on PSET4 Recover, and got to writing to the output file, but for some reason, it SegFaults when I try writing to a jpg. The error, as far as I can tell, occurs in the While Loop in the ...
0
votes
1answer
36 views

pset4 recover - how can I get last few bytes to JPG

I've finally gotten recover.c to the point where it compiles. When I run it, it gives me this error message: munmap_chunk(): invalid pointer Aborted But it also generates all fifty of the pictures! ...
0
votes
1answer
44 views

CS50 Week 4 Recover. Generating 50 Blank images

Here is the code any help is greatly appreciated. Thanks! #include <stdio.h> #include <stdlib.h> #include <cs50.h> #include <stdint.h> #include <stdbool.h> typedef ...
0
votes
1answer
40 views

Recover jpeg runs only in debug

When I run my code in debug mode it works fine and creates 50 jpg images. When I run it like ./recover card.raw it waits forever without an error code. When I submit it, it times out. What am I doing ...
0
votes
1answer
46 views

Segmentation Fault with Problem Set 4 (Recover)

I am getting a segmentation fault when running my program that only allows me to print out 1 broken image. However, when I run the program with valgrind it prints out 49 of the 50 photos, and the only ...
0
votes
1answer
50 views

Pset4 Recover - Unexpected Output

My program outputs JPEG files, but not enough and they are corrupted. It has been a long day and it is Friday. Any kind of push in the right direction would be fantastic thank you. #include <stdio....
0
votes
1answer
63 views

pset4 / recover / invalid or unsupported image format

I've been working on RECOVER from PSET4. I'm able to compile and it creates all 50 images. When I try to open any of the images I get an error saying "invalid or unsupported image format". I'...
0
votes
1answer
55 views

pset4 / recover Segmentation Fault

I have been trying to solve RECOVER from PSET4 and I keep getting a segmentation fault. Any ideas on why this happens? Thank you so much for any help. #include <stdio.h> #include <stdlib.h>...
0
votes
1answer
53 views

PSET4 recover: program compiles but doesn't recover any image

So, I'm using quarantine to learn C. I'm currently stuck at the Recover problem. My code compiles, runs but the result is not what I would've expected. I've explained this code to myself a thousand ...
0
votes
1answer
59 views

For PSET4 recovery, i can compile and now get 49 pictures, check50 error: “recovers middle images correctly recovered image does not match”

I think my "while" condition to read till the end of the file seems correct unlike most of other answers so i'm not sure what is wrong #include <stdio.h> #include <stdlib.h> #...
0
votes
2answers
107 views

pset4 recover works correctly but fails check50. (not a duplicate because i want to figure out why MY code does not work)

this is my code: #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { // Check usage if (argc != 2) { return 1; } ...
0
votes
1answer
110 views

Last cs50 check not working help pls sos, I'm a beginner in C!

Can someone please point out to me what I did wrong? I keep getting the :( recovers 049.jpg correctly recovered image does not match error, I did all my research on other questions threads here ...
0
votes
2answers
48 views

Incompatible pointer types passing BYTE to FILE

#include <stdio.h> #include <stdlib.h> #include <stdint.h> //Define BYTE typedef uint8_t BYTE; int main(int argc, char *argv[]) {//Check if command line is correct// if (argc != ...
0
votes
1answer
38 views

Code only detects one jpeg in pset4 recover problem

my code for pset4 recovery only detects one jpeg signature. Here's my code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <...
0
votes
1answer
70 views

segmentation fault in recover probably due to sprintf

#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { if (argc != 2) { return 1; } FILE *memory_card = fopen(argv[1], "r"); if (!...
0
votes
2answers
68 views

Pset4 recover: when I press enter, there's no results but just go to the next line

The code compiles and everything's good when I run it with debugger.(I set a breakpoint at the third line from the last.) But when I typed ./recover card.raw in command line and press enter, the ...
0
votes
1answer
68 views

How to write a fread function

Soo i'm a little confuse about the fread/fwrite function ... from what i understood in the videos, you need 4 input for those to work, let's use fread for the exemple fread("place to store the data",...

1
3 4
5
6 7
18