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
77 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
2answers
52 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
181 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
692 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
1answer
100 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
2answers
148 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
138 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
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
220 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
439 views

Pset4 Recover - Segmentation fault using while loop (fgetc function)

When I ran the program, it said that there was a segmentation fault. I tried using debug50 to identify the source of the fault and it pointed to the line of code that I have bolded. I don't understand ...
0
votes
1answer
216 views

pset4 recover with malloc having a segmentation fault

I can't seem to find the reason of why I'm getting the segmentation fault in my code. The moment my code starts to write the bytes of buffer, I encounter the fault Any help is really appreciated. #...
0
votes
2answers
158 views

no any jpg found in recover.c

~/workspace/pset4/recover/ $ check50 cs50/2017/x/recover :) recover.c exists. :) recover.c compiles. :) handles lack of forensic image :( recovers 000.jpg correctly 000.jpg not found :( recovers ...
0
votes
1answer
87 views

pset4, recover, nothing happens in terminal

I'm having alot of trouble understanding recover. So far, when i try to run the command ./recover card.raw in the terminal, nothing happens- not even an error message! if someone could guide me as to ...
0
votes
1answer
112 views

pset4 recover.c Why are my pictures scrambled?

My attempt at recover.c almost works. It creates 50 jpegs and names them appropriately. And it fills them part way before getting scrambled. Here is an example: Here is my code: #include <stdio....
0
votes
1answer
231 views

pset4- recover invalid or unsupported image format

In recover my code compiles and runs. It then creates 50 images (named correctly) but they do not open and I get a 'invalid or unsupported image format' warning when I try to open them. I have looked ...
0
votes
2answers
118 views

pset4, recover.c: fails to recover middle, end images with check50

First, I have read the forum's discussion rules, and I have reviewed every post relating to recover.c I can find on reddit, StackExchange, and the other discussion boards. Since none seems to address ...
0
votes
1answer
136 views

PSET4 Recover Can't Open JPEGs in the IDE

I've recovered all 50 JPEGs and when I download them to my computer and change the name from (for example) 000.jpg%OA I can see the picture correctly. However, in the IDE,if I open the same JPEG I get ...
0
votes
1answer
92 views

My code recovers every image but is still not passing check50. It seems like i am missing some data in my jpegs, but i can't understand why that is

int main(int argc, char *argv[]) { //ensure proper usage if (argc != 2) { fprintf(stderr,"Usage: ./recover infile\n"); return 1; } // remember filename char *...
0
votes
1answer
142 views

pset4 recover-Can't figure out how to proceed

This is the code I've been able to figure out. I really don't know how to procced further. Any help would be much appreciated. #include<stdio.h> #include<cs50.h> #include<string.h> ...
0
votes
1answer
273 views

Having some tough time with pset4 recover.c

I've hit a wall and would appreciate some of you more experienced people to help me through or point me in the right direction. Below is my code, and it generates 27 JPEGs all distorted (numberer 0 - ...
0
votes
1answer
306 views

Recovering JPEGs fails Check50 CS50 pset4

What it has to do: Iterate through each block of 512 bytes in input file. When found JPEG header, assuming that it is start of JPEG write it to a separate file, continue until new header is found, ...
0
votes
1answer
2k views

PSET 4: load of null pointer of type 'BYTE' (aka 'unsigned char')

I get a segmentation fault, specifically: load of null pointer of type 'BYTE' (aka 'unsigned char')' error when I try to compile my code. Any assistance is kindly appreciated. #include <stdio....
0
votes
1answer
72 views

Pset 4 - Recover - Not detecting all files / Corrupted Files

My program is managing to detect only 10 jpegs and the files are corrupted. I think my main issue might be the way my loops are constructed or my calls to fseek() but I'm not sure... Any advice is ...
0
votes
2answers
41 views

Segmentation fault in recover.c pset4 after making 1 jpg file

#include <stdio.h> #include <stdint.h> #include <cs50.h> typedef uint8_t BYTE; int main (void) { char* filename = "000.jpg"; int counter = 0; bool found = false; ...
0
votes
1answer
191 views

How to use fseek along side arrays? Pset4 recover

I'm re-wrote this code and did not get any output or error. Tried valgrind and nothing was leaked. I suspect it's either: 1) my fseek is not moving my cursor in inpt 'card.raw' 2) and/or.. because ...
0
votes
1answer
149 views

pset4 recover only 24 wierd looking images recovered

My code is only generating 24 pictures, and they look super weird (colors all over). I know there are a lot of similar questions but I been searching for several hours and still haven't found the ...
0
votes
1answer
86 views

recover.c: jpgs Don't Exist

I open my file for writing and I use sprintf to create my jpgs. However, Check50 says that none of the jpgs exist. Is there an issue with how I am using fwrite and sprintf? Thanks in advance. My code:...
0
votes
1answer
213 views

Why does my program only recover 25 jpegs?

#include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int main(void) { //open file FILE* file = fopen("card.raw", "r"); //declare buffer variable BYTE ...
0
votes
1answer
64 views

PSET 4 recover: segfault when reading buffer

I'm receiving a segfault when reading the first byte (and probably would on the following) of buffer which is a malloced array -- or perhaps not, if unsigned char * doesn't mean what I think it does. ...
0
votes
1answer
290 views

pset4 recover, 000.jpg correct, but middle and last incorrect

I have run my program and it works (at least looks like). My code recovered all the 000.jpg to 049.jpg. The 50 jpgs show in the "jpg folder, and I can see all the 50 faces of the teaching team. ...
0
votes
2answers
38 views

PSet4 recover.c SegFault: cannot figure it out!

I am struggling along with recover.c of Pset4. I have pieced together - from the instructions and inspiration from other users - a program that I think should work, but I get a SegFault and I cannot ...
0
votes
3answers
86 views

Pset 4 recover - fails check50 ('Expecting an exit code of 0')

Help please! My code recovers all of the images, and they can all be viewed, but it fails check50. Would anyone be kind enough to take a look and point me in the right direction? Here's a link to ...
0
votes
1answer
51 views

Segmentation fault in recover.c of pset4

Below is the function createjpg() I wrote for recover.c of pset4. I have written void createjpg (void) { // opening card.raw FILE* inptr = fopen("card.raw", "r"); // ensuring that the desired file ...
0
votes
2answers
242 views

Segmentation fault in recover.c (pset4)

On checking with valgrind, I get main (recover.c:89) ==14182== Address 0x55022c8 is 0 bytes after a block of size 8 alloc'd There are 2 more problems with malloc again, while doing sprintf and ...
0
votes
1answer
74 views

PSET4 Recovers 50 Images

The attached code recovers 50 images, though all have a 'transparent' background. I suspect the issue is with my signature detection code, but I am clueless to where. I would be grateful if you could ...
0
votes
1answer
134 views

PSET4 Recover.c not clearing Check50

In Pset4 everything is going fine, but recover.c, which inside the IDE works pretty well, recovering all the 50 images in card.raw flawlessly, fails miserably with check50. when I run it through ...
0
votes
1answer
113 views

Doesn't pass the last test

When I try my code on Check50, it says it doesn't recover the last file correctly, because it's "Checking for file 015.jpg.". The last file is 050.jpg, and it even says so in cdn.cs50.net/2016/x/...
0
votes
1answer
698 views

pset4 recover “File size limit exceed”

This is what I've created to solve recover. When I run it, the IDE gives an error that File size limit exceeded. Please check this code and tell me what part of it is wrong. What I am exactly doing: ...
0
votes
1answer
251 views

Why is my recover.c solution writing invalid .jpg files?

First, just to be clear: I know my solution is an abomination. I know of several problems with it, and I will be doing it the right way, with a buffer and a while loop and a check for EOF and all of ...
0
votes
2answers
133 views

Data in recover.c doesn't seem to be aligned at 512-byte intervals… what am I missing?

The instructions for "recover.c" in pset4 seem to indicate that all the jpeg photos will be aligned with a block of 512... eg, I only need to check the first 4 bytes starting at 0, 512, etc to find ...
0
votes
1answer
928 views

PSET4 recover.c worked well but didn't pass check50 test

So my recover.c worked and recovered all 50 photos, all of them are viewable. The program also passed Valgrind test with no leak in memory. However, it didn't pass check50 test. The results are: :) ...
0
votes
1answer
531 views

pset4 recover check50 error

I would like some help with recover, after few days of struggle I managed tp finish pset4 recovering all 50 images from file but when i run the cs50 check test it gives me this error $ check50 2015....
0
votes
1answer
61 views

pset4 Can't detect a single photo in recover

I face a problem in which the function isjpgheader() never ever returns true for any photo. I would appreciate if someone can offer some advice as to why the function is not working, thank you very ...
0
votes
1answer
755 views

pset4 - Recover - doesn't pass check50 but works

So, I have finished recover.c (2016 edition) and it recovers all 50 of the jpg-s, and labels tham from 000 to 049. I have looked at every jpg, and they seem intact, all of them (I opened each of them ...
0
votes
1answer
1k views

File size limit exceeded error in resize.c

#include<stdio.h> #include<stdlib.h> #include<stdint.h> int main(int argc, char* argv[]) { FILE* card = fopen("card.raw", "r"); if(card==NULL) { printf("File cannot be ...
0
votes
1answer
127 views

pset4: recover.c

My code creates 16 jpgs, with the correct naming as well, but they all start with the wrong bytes and I can't figure it out...; int main(int argc, char* argv[]) { // open card file FILE* inptr = ...
0
votes
1answer
595 views

Why can't my recover program open card.raw?

card.raw is in the same folder as my recover program. When I try to execute it, my program spits back to me "file could not be opened" which is what I programmed it to do if the file pointer returns ...
0
votes
1answer
433 views

recover.c; don't know how to find the first 4 bytes

Below is my code. It doesn't even compile, because I get the following error: "passing 'unsigned char [512]' to parameter of type 'char *' converts between pointers to integer types with different ...
0
votes
2answers
259 views

PSET4 Recover Problem to repair .jpg's signature in hexadecimal

I'm not sure if I use correctly the hexadecimal notation to verify if there is a .jpeg signature in the beginning of my BLOCK of 512 bytes. My program compile well but no photograph is revealed. May ...
0
votes
1answer
107 views

Is there a more elegant way than this to search for the start of a jpeg? (pset4 recover.c)

// start of new jpeg? if (buffer[0] == 0xff && buffer[1] == 0xd8 && buffer[2] == 0xff && (buffer[3] == 0xe0 || buffer[3] == 0xe1)) There must be, because this ...

1 2 3
4
5
18