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

pset 4 recover still getting memory leaks

I've been told before that my code is getting memory leaks (when running Valgrind this becomes apparent) so I now free memory at the end of the program, but I'm still getting leaks. Even beyond ...
0
votes
1answer
59 views

Code runs, but no JPEGs are formed in recover

#include <stdio.h> #include <stdlib.h> #include <cs50.h> int main(int argc, char *argv[]) { // ensure proper usage if (argc != 2) { fprintf(stderr, "The program ...
0
votes
1answer
84 views

pset4 recover not sure why I get segmentation fault

Really clueless to why I get a segmentation fault on this problem, I have a hunch it may be something regarding the creation of the outfile. #include #include int main(int argc, char *argv[]...
0
votes
1answer
58 views

pset4 recover code compiles but doesn't run

I thought I had everything figured out when my code compiled, but unfortunately it doesn't recover the images or do anything at all for that matter, and I'm not sure why. #include <stdio.h> #...
0
votes
1answer
59 views

pset 4 recover, won't recognize file outptr

#include <stdio.h> #include <stdlib.h> // I got information about what to do with the buffer // from this stack exchangehttps://cs50.stackexchange.com/questions/2680/ //...
0
votes
1answer
222 views

pset 4 recover, questions about purpose of using buffer

#include <stdio.h> #include <stdlib.h #include <stdint.h> // I got information about what to do with the buffer // from this stack exchangehttps://cs50.stackexchange....
1
vote
1answer
225 views

My code works, but dont know why it is char filename[7]. Why 7? Why not another number?

My code works, but dont know why it is char filename[7]. Why 7? Why not another number?Thanks. // create filename char filename[7]; sprintf(filename, "%03i.jpg", ...
1
vote
2answers
90 views

pset 4 - recover: undefined behavior?

I got a question regarding check50 on pset4 - recover. If i run check50 a couple times in a row, without even compiling my code in between I get different results (might be all green smileys or ...
2
votes
2answers
285 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 ...
0
votes
1answer
82 views

pset4 recover: first byte of buffer seems unexpectedly changes to 0

Thanks for seeing my question, I appreciate your help. :) Let's get to the point. My code compiles and runs without any errors. Images are generated, but the images are incomplete, here's an example ...
0
votes
1answer
161 views

pset4 recover can create 50 images but all white and grey check

when I run my code, 50 images are produced but they are all white and grey checks. and when I run check50, the comments are below. I do not know what went wrong in my code. any suggestion would be ...
0
votes
2answers
51 views

pset4:recover, finds only 28 images and they are unsupported format

As the title suggests my program finds only 28 images and they are unsupported format and won't open (the file names are correct though). Please can anyone highlight any issues with my code or point ...
0
votes
1answer
188 views

pset4: recover. double free or corruption (out)

Can somebody please help? When I try to run my program I get this message, * Error in `./recover': double free or corruption (out): 0x00007ffe270739f0 * Aborted I can't seem to find the issue. From ...
0
votes
2answers
55 views

PSET4 - Recover: Error in './recover': double free or corruption (top). Can't figure out what's wrong

I can't seem to figure out why this error is occurring. I used fclose() only once per file pointer. #include <stdbool.h> #include <stdint.h> #include <stdio.h> typedef uint8_t BYTE;...
0
votes
1answer
55 views

pset4 recover: Segmentation fault - Unsure of fix

I am very new to programming and am having problems with a segmentation fault in the code below. Any sort of guidance on where I have gone wrong would be very much appreciated. It is most likely ...
0
votes
1answer
26 views

*** Error in `./recover': double free or corruption (top): 0x000000000294a250 *** in recover pset4

I got this error when working in pset4(recover) and i can't see where exactly did i free something twice, can some one help me with it, by the way do i need to use a File *pointer with append as a ...
0
votes
1answer
223 views

pset4 recover not creating JPEGs

my code here compiles but does not create the file. Have tried changing many things... any ideas on what i'm missing? Thanks! Will #include <stdio.h> #include <stdint.h> #include <...
0
votes
1answer
135 views

CS50 Pset4 Recover card.raw only NULL

Okay so I am starting the recover program from Pset4 and I initially just want to get some output, any output, I have been trying to read the first few bytes from recover.raw but for some reason seem ...
0
votes
1answer
40 views

PSET 4 Recover If condition never true

I have been spending quite some time now on PSET 4 recover. After using Debug50 several times, I see that what is blocking is the fact that my if condition never returns TRUE and thus I can never find ...
0
votes
1answer
131 views

pset4 recover single image

My recover program currently successfully returns a single image "001.jpg" which looks good when I open the file. It also returns a second image "002.jpg" which prompts an error for an Unsupported or ...
0
votes
1answer
92 views

pset4 recover fails check50 but gets all 50 images

This is a last resort, I've never asked a question here . . . I see all 50 images (I'm assuming that's correct for CS50?) :-) but check50 is saying it has not recovered 000.jpg, 001.jpg, 049.jpg, ...
0
votes
1answer
162 views

PSET4: Recover, unable to solve the errors

Questions: I don't know why I'm getting the first error, I used unsigned char for file1. I didn't understand how sprintf(file1, "%03i.jpg",2); FILE *img = fopen(file1, "w"); will create a jpg file. ...
0
votes
1answer
155 views

Recover: invalid or unsupported image format

#include <stdio.h> #include <stdlib.h> #include <stdint.h> int main(int argc, char *argv[]) { if (argc != 2) { fprintf(stderr, "Usage: ./recover Card.raw\n"); ...
0
votes
1answer
56 views

Can someone please explain why I am getting a segmentation fault ? (recover pset4)

#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { if(argc != 2) { fprintf(stderr, "please give the correct input."); return 1; } ...
0
votes
1answer
284 views

Pset 4 : Recover, Segmentation fault

I am having problems identifying where i have gone wrong in the below code. On running the program i am getting segmentation fault. i have gone through many related tags and answers but cant ...
0
votes
1answer
81 views

Problem Set 4 Recover Issues. I can't figure out why my code doesn't work

I'm busy with problem set 4, and I can't figure out why my code doesn't work. What seems odd is that the first line or two of a new jpeg will seem partially or fully correct, but thereafter the images ...
0
votes
1answer
195 views

recover pset4 file handling

I got this code to work, but I have a few questions for my own clarification. On line 68 where I define the jpg title, why is it a single character? The actual title 001.jpg is much longer than a ...
0
votes
1answer
829 views

Pset4 Recover: Program creates segmentation fault

I'm new to writing programs that read or write files and I am totally stuck as to the reason I keep getting a segmentation fault. I feel like it might have to do with one of my file pointers or newly ...
0
votes
2answers
46 views

CS50 , PSET 4 , Recover , segmentation fault

I reviewed my code 10 times and still not know why it gives segmentation fault when I run , I could use a help of an expert , thanks in advance. #include <cs50.h> #include <stdio.h> #...
0
votes
1answer
274 views

pset4 recover images do not match

I ran my code through the compiler and the recovered images are all blank. The images do not match when I ran my code through check50 as well. I can't identify the problem with my code. I would ...
0
votes
1answer
70 views

Pset4 cannot recover images

I am not sure what is the problem in my code that is preventing the images from being recovered from the card.raw file. I've looked through my code and can't find the problem. Really appreciate it if ...
0
votes
1answer
103 views

PSet4 recover: recovered files start with a wrong sequence

My recover program creates 50 files, but they do not open (it says "Invalid or Unsupported Image Format"). I opened some of the JPEGs with a hexadecimal editor and found out that they start with 00 d8 ...
0
votes
1answer
96 views

Pset4 recover.c compiles but fails to create any file

can't figure out what's going wrong with my code. It's compiling without any errors but still it doesn't create any jpg file or any file at all. Here's my code: int main (int argc, char* argv []) { ...
0
votes
1answer
42 views

Pset 4- Recover. Issues with properly formatting code

I have a problem where I need to check if I have an open file on my loop, so I properly close the previous file before writing a new one. But my check only works if I fclose(img) if my counter > 0. ...
0
votes
1answer
48 views

Recover - “recovered photo does not match”

So I'm nearly finished with recover. It recovers 50 jpegs but I can't open any of them. I just can't seem to figure out what is causing the issue looking through my code. Any help would be appreciated ...
0
votes
1answer
94 views

Pset4 Recover - Error using fclose

(This was also posted on reddit, but I think it's been lost, sorry) Hi guys, currently doing recover. I'm having trouble with using fclose on my output file pointer (jpegptr) - every time I try to ...
0
votes
2answers
221 views

Character array values return 4 bytes instead of 1

I'm helping my son work on the recover.c assignment trying to recover JPEGs from card.raw disk image file. I'm running into a strange behavior trying to display bytes from my 512-byte buffer which is ...
0
votes
1answer
141 views

Recover - images are blurry and incomplete

The images are created but come back as blurry messes. I can't see my bug so I'm hoping to get a hint. int main(int argc, char *argv[]){ // take in single card name if(argc > 2){ fprintf(...
0
votes
1answer
42 views

pset4 recover, cannot open jpg

Can somebody please help me with the code, I couldnt figure out why the pictures cannot open. It's didn't show any error. Thanks. #include <cs50.h> #include <stdio.h> #include <stdlib....
0
votes
1answer
71 views

my recover is not able to read card.raw

I have some problem with my recover code. I based it on copy.c so the beggining lines are : int main(int argc, char *argv[]) { // ensure proper usage if (argc != 2) { fprintf(...
0
votes
1answer
275 views

pset 4 recover : all images are grey and white boxes

My recover program compiles and runs (finds 27 images). While opening them they all seem to be different at least in shape. However the copying seems to be problematic (all made of white and grey ...
0
votes
1answer
30 views

Recover pset : cannot manage to check jpg signature

I am having many troubles with the recover problem but for the moment the most important one seems to be that my code doesn't even pass the step to go through my if loop to find the jpeg start. Here ...
0
votes
1answer
477 views

pset4: Recover. Double free or corruption(top) error

I am getting the following output whenever I run my program: Error in `./recover': double free or corruption (top): 0x0000000002a75250 Aborted Also, when the program is executed, it does create the ...
0
votes
1answer
187 views

PSET4 Recover images not showing correctly

Here is updated code with answer. #include <stdio.h> #include <stdlib.h> #include <stdint.h> int main(int argc, char *argv[]){ if (argc != 2){ ...
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
1answer
221 views

CS50 Recover did not pass check50

I am currently struggling to pass pset4, specifically on Recover. I already search other questions in forum and it seems there were no solutions to my problem, so I am stuck. From card.raw i could ...
0
votes
1answer
56 views

recover.c doesn't create any file

Please have a look at my recover.c and please help me #include <cs50.h> #include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { char *infile=argv[1]; if(argc!=...
0
votes
1answer
75 views

CS50 Pset 4/Recover-retains 50 broken JPEGs

My code compiles/executes and retains 50 JPEGs, however, these JPEGs are broken, I have gone through my code many of times, have discarded other versions, I seem to be missing something I can't spot ...
0
votes
1answer
30 views

recover more than 1000 jpg

#include <stdio.h> #include <stdlib.h> //int main(int argc, char* argv[]) int main(void) { // TODO int count=0; char name[8]; unsigned char buffer[512]={0}; FILE * ...
0
votes
2answers
69 views

The IF in recover

do not understand why the "if" statement offered by zamyla in the recover problem works. I can see the first three conditions but the last one is confusing. if (array[0] == 0xff && array[...

1
5 6
7
8 9
18