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
0answers
9 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
22 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
16 views

Pset4 - recover - issue with file pointers

I'm working on recover and I think I'm nearly there but I can't resolve an issue with file pointers. When I'm compiling I'm getting two errors both say error: use of undeclared identifier 'ptr'. I ...
0
votes
1answer
14 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
16 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
18 views

Can't seem to wrap my head around what the Bitwise AND operator does in Pset4 vs. && AND operator

I just watched the Recover video and I saw them mention bitwise arithmetic, but I am not exactly sure what that means nor what it does. I saw another forum post explain it but that also didn't really ...
0
votes
2answers
43 views

Pset4 Recover: succesfully recovers first and second image, unsure as to why no other image is recovered (spoiler)

I must admit I'm having particular trouble in this assignment. Maybe it's the amount of new concepts. I think I have the idea down but I must me missing an error regarding the loop. I've tried ...
0
votes
1answer
25 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
2answers
25 views

Valgrind - 2 memory leaks | Recover.c | Pset-4

Valgrind encountered two errors in the following code. I'm not able to get why is this happening even when I close files and free allocs. Please help if you can. #include <stdio.h> #include <...
0
votes
1answer
33 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
26 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
28 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
9 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
1answer
17 views

Understanding the contents of the raw file

I'm playing around with file pointers in preparation for the Recover Problem. I'm trying to understand something here. I can't actually open up the raw file to read on my IDE. And neither can I read ...
0
votes
0answers
20 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
1answer
32 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
0answers
28 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
2answers
28 views

Why does my code lead to segmentation fault [CS50 recover.c]

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

PSET4 - Need help with Recover problem

I am stuck in this problem, when I run it I keep getting a segmentation fault. I think that the bug in my code is in the while loop. In the walkthrough of the problem it was suggested to check if ...
1
vote
2answers
31 views

Major Help Needed on CS50 - Recover

I would love any possible help with this code. I think I've got the general idea, but I keep running into segmentation faults. Thank you to anyone who gets a chance to look this over! I've been very ...
0
votes
1answer
39 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
25 views

PSET 4 Recover - Copy-Pasting 1 Line from 1 Place to Another Causes Huge Error

This Code Below Worked Fine, I got Passed!! #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <stdint.h> typedef uint8_t BYTE; int main(int argc, char *...
0
votes
1answer
43 views

PSET4 Recover: Where do my ###.jpg files end up?

My code looks right, and after some segmentation errors, I finally fixed that, but I've run into a problem: My created ###.jpg files don't actually seem to be written to anywhere, as in I can't find ...
1
vote
1answer
52 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 "...
0
votes
1answer
36 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
41 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
39 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
30 views

pset4 - My recover programme compiles but doesn't generate JPEGs as expected

After 12hrs of banging my head against this, and having trawled Stack Exchange, I've decided that it's time to ask for help! Really not sure where I'm going wrong, but suspect it's related to the ...
0
votes
1answer
46 views

pset4 recover fwrite function

I'm not sure where I went wrong with my code. Am I using fread and fwrite correctly? Thank you in advance!! //opens the file FILE *f = fopen(argv[1], "r"); //if the file contains nothing, ...
0
votes
2answers
59 views

PSET 4 Problem Set Recover

I've been working on Recover a few days now and managed to actually create a program that retrieves the images. The only problem is that they are not retrieved correctly and don't match what they are ...
0
votes
1answer
51 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
1answer
45 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
1answer
36 views

Pset4 Recover. I think that I did well but it doesn't work

I was struggling with this code for three days. someone could help me? What should i fix? Please, if you are so kind, give me a tip, not the solution! I wrote a lots of comments to you can understand ...
0
votes
2answers
51 views

Issues with PSET4 recover (recover.c), can't create jpg's (segmentation fault)

Can't seem to find what is happening with my code, please help! I've been stuck in this problem for way too long. The jpg's are not created when I run the code. #include <stdio.h> #include <...
0
votes
0answers
23 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
2answers
88 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
62 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
36 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
3answers
96 views

Pset4 recover: Images recovered but check50 failed

I am currently stuck on this problem set, as it seems like I am able to recover the 50 jpgs but I am failing the check50. I am not sure what I am doing wrong and would appreciate some help. :( ...
0
votes
2answers
46 views

PSET 4 Recover, don't know what's causing seg fault

My code has been suffering from a seg fault, I followed the logic from the walkthrough pseudocode but unfortunately I cant seem to fix the issue. #include <stdio.h> #include <stdlib.h> #...
0
votes
1answer
53 views

Recover compiles fine, does not 'recover', and fails Check50

Any ideas where I'm going wrong? I seem to load all of the recovery data into image "000.jpg", never climbing out until I reach the end of the file. However, I cannot understand why this is so. ...
0
votes
0answers
25 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
33 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 <...
-2
votes
1answer
46 views

While loop for recover pset4

I need a plain English explanation of how the while loop operates for the fread statement. After reading in the first 512 bytes, how does it loop to the next 512 bytes till it gets to the last block?
0
votes
1answer
39 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
1answer
44 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 ...
0
votes
1answer
59 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
41 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
79 views

PSet4 Recover, only finds 22 corrupted photos, doesn't pass Check50

Originally, my code always returned Segmentation Faults whenever running it. I used printf statements to find and fix the segmentation faults, but now it is only finding 22 out of the 50 photos and ...
0
votes
1answer
200 views

Help with “RECOVER” Pset4

My program keeps failing the last 3 on check50 '.jpg not found'... I dont see what the problem is, can someone help? #include <stdio.h> #include <stdlib.h> #include <stdint.h> ...

1
2 3 4 5
17