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

Recover - PSet 4

I am for some reason unable to generate any jpgs with my code; I think there's a mistake in the logic somewhere? Would be very grateful for some hints! Thank you! #include <stdio.h> #include <...
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
17 views

PSET 4 - Recover produces an infinite loop

I have been working through this problem and cannot figure out why this while loop is producing an infinite loop and no image files, which is probably caused by a logic error on my part. As far as I ...
0
votes
1answer
23 views

PS4 Recover Segmentation Fault (Core Dumped)

Hope you got into the new year well and healthy! I get a segmentation fault (core dumped) if I want to run ./recover card.raw Anyone got any tips because I have checked it 100 times already. Valgrind ...
0
votes
1answer
13 views

PSET4 - Recover - program timing out and not passing the check

could you please help me to understand why my program is not passing the check - the error says "timed out while program is trying to exit". It's compiling well, but seems to not even create ...
0
votes
1answer
17 views

PSET4 - Recover - Segmentation fault, not sure what's wrong

Can't understand what's wrong in my code: it's compiling but not creating jpgs, the check says "failed to execute program due to segmentation fault". Please help to understand - THANKS IN ...
0
votes
1answer
22 views

Regarding PSET4: Recover is compiled but only 26 files are recovered but unable to open images

#include <stdio.h> //call for sprintf() #include <stdint.h> //call for typedef uint8_t BYTE #include <stdlib.h> //call for sizeof() and NULL typedef uint8_t BYTE; //...
0
votes
1answer
22 views

pset4 recover.c last image does not match

I've doing recover.c from pset4. When I ran check50, all images except for the last one. I guess it's probably the problem of feof function. But I don't know how to edit my code to make it works //...
0
votes
1answer
17 views

pset4 recover creates 50 images but bytes don't match up

My code creates the 50 files, all of them starting with the correct JPEG signature, however the rest of the bytes don't match up. In other words, first 4 bytes are correct, the following bytes are ...
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

My recover doesn't stop executing once it starts

Not actually sure what is wrong with my code but it doesn't end when it's executed. I tried adding return 0 so it would end but it's not working. code: #include <stdio.h> #include <stdlib.h&...
0
votes
1answer
20 views

PSET 4 Recover.C wrong exit code?

Currently getting the following errors when working on pset4 for the class CS50. Not sure why my exit code is none? Please let me know if you guys know what the issue is. Thank You. :) recover.c ...
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
0answers
17 views

How do I interpret Valgrind to fix this program's segmentation fault?

I was attempting PSet 4's Recover but kept running into a segmentation fault. I tried using Valgrind to debug it but I have no idea of how to interpret the error message. My code: #include <stdio.h&...
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
50 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
44 views

I really don't know why my code is not working pset4

I'm not good a programming but I'm really trying so I've been stuck for days in the same problem and any advice could be helpful Here's my 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
26 views

Images shifted with no 049.jpg in recover

My code compiles and runs and the images load and seem fine BUT it skips the first image and ends at 48. There IS an image named 000.jpg that is output but that image under the name 000.jpg from what ...
0
votes
1answer
18 views

how can I rewind the fread() funtion as byte

is there a way to fread() the same bytes you just had read? fread(buffer, 512, 1, inptr); if (header(buffer) == true) { //execute these lines do { //execute these lines } ...
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
2answers
51 views

CS50 Recover (Pset4). What exactly is causing the segmentation fault?

CS50 NEWBIE here. Program successfully compiles but I keep getting a segmentation fault error when trying to run it. After some debugging, I think the problem has something to do with trying to close ...
0
votes
1answer
48 views

why does it fail check50 for the last image?

#include <stdlib.h> #include <stdio.h> typedef unsigned char BYTE; int main(int argc, char *argv[]) { if (argc != 2) { return 1; } FILE *infile = fopen(argv[1], &...
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
0answers
24 views

Week 4 recover seg fault

#include <stdio.h> #include <stdlib.h> #define BYTE 512 #define NAME 8 int main(int argc, char *argv[]) { //check for valid input if(argc != 2) { //Promt user for valid input printf("...
0
votes
1answer
33 views

So i have written the recovery code which compiles but all the images are Invalid and Unsuported format

#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { if (argc < 2) { printf("Usage: ./recover image\n"); ...
0
votes
1answer
52 views

PSET4 Recover: Check50 shows error

#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> typedef char* string; typedef uint8_t BYTE; int main(int argc, char *argv[]) { if (argc != 2) { ...
0
votes
1answer
33 views

pset4 recover error - timed out while waiting for program to exit

i am getting a timed out error but don t understand why...? also i can see all the pictures except the last one (049.jpg) ... #include <stdio.h> #include <stdlib.h> int main(int argc, ...
0
votes
1answer
23 views

Pset4 Recover JPEG images do not match

Getting closer on Pset4 Recover but still working through some issues. I am now generating jpegs (yay!) but they apparently do not match the original images. So I am getting three errors: :( recovers ...
0
votes
0answers
23 views

Why are the recovered jpgs messed up?

Sorry for asking such a general question but I cannot understand why my code does not recover the images fully. In most of the images one can see a fraction of the image. check50 tells me that there ...
0
votes
1answer
34 views

Pset4 Recover Problem With Seg Fault *Updated*

Getting closer on this now and am no longer getting a segmentation fault. However, my Jpeg images created by the program are not correct. I think part of the problem is that I am writing rather than ...
0
votes
1answer
33 views

Pset4 Recover Creating Segmentation Fault

Trying to work through Pset4 Recover. Currently getting a segmentation fault and not opening any new jpegs. My logic thinking here was to: Make sure user submits just 1 command line argument Open ...
0
votes
1answer
29 views

Pset4 Recover Segmentation Error. Valgrind unable to find anything

I'm sorry to bring about yet another segmentation fault but I cannot for the life in me find the error (Even valgrind is kinda malfunctioning). Here's my code- #include <stdio.h> #include <...
0
votes
0answers
25 views

Recover, almost there… images doesn’t show correctly

I think I'm very close to getting this one right, but I've been trying different codes with the same results so I think my logic must be wrong. This code finds correctly the jpegs and creates the ...
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
49 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
31 views

CS50 pset 4 Recovery timed out even though everything compiles

There seems to be an infinite loop in my program that I'm unable to find, could someone please help me Here's my code #include <stdio.h> #include <stdlib.h> #include <cs50.h> #...
0
votes
0answers
15 views

problem set 4 recover, segmentation fault

#include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int main(int argc, char *argv[]) { if (argc != 2) { printf("Usage: ./recover image\n"); ...
0
votes
1answer
35 views

pset4-recover: can get 50 photos but a column on the left appears on the right, problems of colors and on the first portion of the photo

I've tried some different values with fread() an with fwrite() but had no new results. On the right in some pictures appears, like a column, part of the image that should be at the left, and in some ...
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
2answers
60 views

Wanting to understand PSET4 Recover Else if statement

I have a question regarding a else if statement for the PSET4 Recover while (fread(buffer, 512, 1, card_raw)) { if (buffer[0] == 0xff && buffer[1] == 0xd8 && buffer[2] == 0xff &...
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
33 views

I'm working on CS50 Recover, but my images aren't showing up and I can't figure out why

#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { if (argc != 2) { printf("Usage: ./recover image\n"); return 1; } ...
0
votes
1answer
50 views

pset4 Recover - seems to recover images correctly but fails check50

Working on pset4 - recover. The program compiles and runs and upon opening the images, they look alright. Check50 returns: :) recovers 000.jpg correctly :( recovers middle images correctly ...
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
28 views

Recover (segmentation fault)

I keep getting segmentation fault on my code. I can't quite pinpoint where the problem lies, but it's most likely within my while loop. Would appreciate if someone can give me a hint or point where ...
0
votes
1answer
34 views

Pset 4 Recover Issue

I am 2 days into PSET 4 Recover. I can get the program to compile successfully without errors but my program is not returning any JPEGs, with no errors to point me in any direction as to what might be ...

1
2 3 4 5
18