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.

171 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
1answer
187 views

Week 4: Recover (invalid stdio handle)

As I'm sure you're aware, the goal of this assignment is to recover a number of deleted jpeg files from a provided memory card image. My code compiles and executes, but I'm receiving the error "...
1
vote
1answer
79 views

How to skip loop iterations with debug50?

I'm struggling with the recover problem. I'm running a while loop that's more than 7 thousand iterations long. I get a segmentation fault because (i'm pretty sure) of the last or perhaps the last but ...
1
vote
0answers
24 views

Empty pointer values in Pset 3: “Recover”

I know pointers don't have to be used in this pset, but my first attempt relies on them. The program has other bugs, but I'm wondering why my pointer variable doesn't get values (keep staying empty) ...
1
vote
1answer
121 views

pset 4 - recover -> invalid pointer

i am trying to solve the recover issue. When I run my programm I get: * Error in `./recover': free(): invalid pointer: 0x0000000001da5200 * Aborted I don't know how to proceed. Can someone please ...
1
vote
1answer
147 views

pset4 recover - 16 images recovered with Invalid or Unsupported Image Format

I'm really confused. I reviewed all similar problems, but did find my case. It seems like jpeg start bytes are detected, but wrong data inserts to the output file. Please advise! 24-Oct-2016: The ...
1
vote
0answers
80 views

Why does chrome not work with server, but firefox does?

I got server (from pset6) working on Firefox, but not Chrome. Chrome will either not show anything, or just show a error message if there's an error. Everything works on Firefox, except it will not ...
0
votes
1answer
21 views

Pset4/recover: Why does it not works? Image names are correct. But it doesn't match. Please help?

:) recover.c exists. :) recover.c compiles. :) handles lack of forensic image :( recovers 000.jpg correctly recovered image does not match :( recovers middle images correctly recovered image ...
0
votes
0answers
14 views

Pset4 able to compile but unable to recover images

My code compiled successfully and it passed check50,but when I implemented it, nothing occurred and no jpg file is created. Can anyone help me figure out what happened? [EDIT: Code removed for Harvard ...
0
votes
1answer
28 views

Segmentation Fault in CS50 Recover - pset4

I would appreciate some guidance on the below issue. I have seen the other threads with the same issue but haven't had any luck applying those fixes. I am getting the below error in my code and I can'...
0
votes
1answer
43 views

Problem with Recover (Pset4)

everyone. I've been struggling with the Recover problem of Pset4. I really don't understand why I'm getting the following error message when applying the Check50 control: *Results for cs50/problems/...
0
votes
1answer
12 views

pset4 Recovered image doesnt match

I´m trying to solve the pset4 recover challenge, but i havent been able to make the program recover the full image, only one part of it. What am i doing wrong ?? This is my code: #include <stdio.h&...
0
votes
1answer
27 views

Where am I mystaking ? pset4-RECOVER

I've been rewriting that code for about a week now and start beeing very confused about what I am doing wrong, I hope my logic isn't fully wrong but I have some doubts about my understanding of ...
0
votes
1answer
28 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
0answers
26 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
47 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
52 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
0answers
25 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
26 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
25 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
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
26 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
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
42 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
40 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
42 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 ...
0
votes
1answer
41 views

pset4 - can't figure out what i'm doing wrong - recover

This is the code: #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { if (argc != 2) { return 1; } FILE *file = fopen(argv[1], "r&...
0
votes
0answers
35 views

Recover.c fprintf failing on the 35th file

So on the recover.c program, my program works to recover the first 34 images, but it segfaults on the 35th. I've determined that it has to do with the fprintf function, but it worked the first 34 ...
0
votes
0answers
19 views

Recover: Images actually duplicating

Edit: I checked the output and it turns out that I am getting duplicate images, can anyone help? So I finally finished Recover, and it works fantastically whenever I run it outside of check50. I ...
0
votes
1answer
43 views

I can only find 13 images using recover

I am aware that the same question has been asked before: PSET4 Recover only finds 13/16 images However, as far as I could try given this answer, I could not fix my function so it would successfully ...
0
votes
1answer
41 views

pset4: recover segmentation fault

The code compiles fine but when running ./recover i keep getting a seg fault. i tried valgrind but still can't seem to get what the problem is exactly. #include <stdio.h> #include <stdlib.h&...
0
votes
1answer
31 views

Find hex values inside a string in C?

I have a long string "given_string", and I'm trying to find hex values within that string. Here's a simplified example: /* Find a sub-string in a given string: */ char * given_string = &...
0
votes
0answers
27 views

Recover Assignment Memory Leak and Insufficient Recovery

I am trying to complete the assignment given by CS50x (Harvard Community Online, edX.org), and while it successfully recovers images, valgrind is telling me that there are memory leaks that happen in ...
0
votes
0answers
35 views

For pset4/recover i keep getting an error despite the pictures recovering when i run the program

could someone please identify whats wrong with my code. im a beginner and completely lost.
0
votes
1answer
67 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? #include <stdio.h> #include <stdlib.h> #include <stdint.h> ...
0
votes
0answers
27 views

Segfault error, please help

I really need help, I'm getting a segfault error. Please look through my code and help me, please. #include <stdio.h> #include <stdlib.h> #include <stdint.h> int main(int argc, char ...
0
votes
0answers
124 views

fread() return value

I am working on recover, currently pset, and only my last photo is not processing properly. I am calling fread(buffer, 1, 512, inptr) to read 512 bytes of data at a time. The video says fread ...
0
votes
1answer
123 views

CS50/PSET4/RECOVER- Error- “Can't open card.raw: file format unsupported”

Keep getting "Can't open card.raw: file format unsupported" error when running the code. Not sure what I'm doing wrong. #include <stdio.h> #include <stdlib.h> int main(int argc, char *...
0
votes
1answer
69 views

PSET4 Recover, Dynamic File Names

So far I've gotten to the point where I can recover one image. I'm to the point where I need to find a good way to make dynamic variable names. I thought of one way to do it, but it seems rather ...
0
votes
1answer
73 views

Recover function in pset4

#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <stdbool.h> /* Open memory card Repeat until end of card: Read 512 bytes of data into buffer If ...
0
votes
1answer
79 views

“File size limit exceeded” in Recover - how does file writing work?

I've been quite frustrated by trying to make progress in Recover. When I run my code, I am unable to make even the first JPEG file as the program continues running until the file size is exceeded. I ...
0
votes
1answer
92 views

PSET4 Recover - Can't Read Card

Having a problem with Recover. The debugger shows that "buffer" is always 0000. Tried everything I could think of here. Any ideas? #include <stdio.h> #include <stdlib.h> #include <...
0
votes
2answers
147 views

Why does my Cs50 recover programme correctly recover all images except the first one?

I wrote the below code and it recovers 51 images: 000.jpg to 050.jpg- all images except img 000 seem to have been found correctly. I'm not sure why the code isn't working? include include include ...
0
votes
1answer
57 views

PSET 4 Code fails two checks

Stuck on this problem for days and I can't figure out why my code is failing, I'll admit I'm struggling to really understand what my code is doing, like how the filename variable works. But I've ...
0
votes
0answers
48 views

Recover program: Can't produce the 50th jpg (049 jpg)

I've tried everything to get that last file, I even ran some printf statement test and the 4 indexes that show the start of a jpg are recognized 50 times in total but i'm still only able to produce 49 ...
0
votes
0answers
53 views

I am having trouble with the 2020 pset4 Recover assignment and even though my code compiles, it doesnt work, its not recovering the images

EDIT: I posted this 17 days ago please help. Heres my code and it wud be great if someone cud help A.S.A.P. thankyou! #include <stdio.h> #include <stdlib.h> #include<stdint.h> #...
0
votes
1answer
52 views

PSET4 Recover - Code gets stuck at if statement

I'm working on the recover problem, but when my code gets to the if statement I made that checks for the header of a JPEG file, it gets stuck. I get no errors, it simply stops iterating through the ...
0
votes
1answer
45 views

Issue with Recover code.While using cs50 check it fails giving the following message : timed out while waiting for program to exit

#include <stdio.h> #include <cs50.h> #include <stdint.h> #include <stdlib.h> #define BLOCK_SIZE 512 #define FILE_NAME_SIZE 8 typedef uint8_t BYTE; bool is_start_new_jpeg(BYTE ...
0
votes
1answer
139 views

PSET4 Recover, don't know how to go through the blocks of data!

I am content on how to read a single 512 byte block in recover, however I'm extremely confused on how to go through the rest of the blocks of the memory card i.e can you do this using fread? I was ...
0
votes
1answer
144 views

PSET4 Recover Segmentation Fault Help

Edit: It has been resolved. I figured it out. Anyone who has similar problem may check my answers below. Try to skip over my code to avoid spoiling yourself. // // // // I have been stuck with ...
0
votes
0answers
39 views

Pset4 Recover segmentation error

Help needed with recover part of pset4. Please find my code below. It compiles but produces a seg fault. Any comments are welcome. Thanks in advance. #include <stdio.h> #include <stdlib.h&...