Questions tagged [pset4recover]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
31 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
11 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
193 views

pset4 recover.c segmentation fault fread/fwrite

I am trying to complete recover.c for pset4, but I am having major trouble debugging. I get a segmentation fault after the first fwrite step has occured, and it creates the fault at the fread step at ...
0
votes
0answers
22 views

Recover not working Pset4 [closed]

int main(int argc, char *argv[]) { // file opened FILE *file = fopen(argv[1], "r"); // user types two inputs if (argc != 2) { return 1; } // ensuring it is a valid file if (file == NULL) { ...
1
vote
1answer
22 views

CS50 recover (fclose giving segmentation fault)

found a few answers to the segmentation fault issue in CS50 recover while closing the file but I couldn't translate the answers to my issue: The last part: fclose(f); fclose(img); is resulting into ...
0
votes
1answer
60 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
26 views

recover compiles but has segmentation fault when running it with ./recover card.raw, could anyone take a look

#include <stdio.h> #include <stdlib.h> #include <cs50.h> int main(int argc, char *argv[]) { //this counter to keep track of how many jpegs found so far int counter = 0; //allocate a ...
0
votes
1answer
28 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
23 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
45 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
13 views

Why is my recover code not giving any output?

I'm very confused why this code is not giving any output: Code: #include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; long int findSize(char file_name[]) ...
0
votes
1answer
96 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
45 views

CS50 PSet 4 Recover, Segmentation Fault

My code compiles, but whenever I run Check50, I get a segmentation fault error for each category. Would definitely appreciate any help identifying where the problem can be fixed! #include <stdio.h&...
0
votes
2answers
58 views

PSET4 Recover: Segmentation fault

I am receiving a segmentation fault stemming from line 95. This is where I am attempting to continue to write the remainder of a JPG file after finding it. [code hidden]
0
votes
2answers
105 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
24 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
1answer
18 views

pset4 reError interpreting JPEG image file (Not a JPEG file: starts with 0x62 0x74)

below will be my code. on check50 I get: :( recovers 000.jpg correctly recovered image does not match :( recovers middle images correctly recovered image does not match :( recovers 049.jpg ...
0
votes
1answer
38 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
47 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
29 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
31 views

My latest two problems aren't being scored

I submitted one of my problem sets and I'm unable to get my problem scored. screenshots:
0
votes
1answer
34 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
1answer
35 views

pset4 Recover “grade”

I recently submitted my Pset4 Recover project to the new grading Bot....and received 0 of 100.....despite the fact that my program returns all 50 photos....reaches the EOF .....Valgrind shows 0 ...
0
votes
1answer
63 views

pset4 recover: too many JPEGs found

guys! I was solving recover, but my program finds way too many JPEGs. I believe that this is because of the following lines: // starting bytes of jpeg are in [lower, upper] uint8_t lower[4] = {0xff, ...
0
votes
1answer
65 views

Recover - error message when I test it : The file won t open to copy inside

I m struggling. Can't find why I have this error message :~/workspace/pset4/recover/ $ ./recover card.raw Could not open new file. Here is my code : //define data ...
0
votes
1answer
29 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
0answers
23 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
34 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
37 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
17 views

Pset4 recover code only shows parts of the picture

I've worked on the code and gotten it to the point where it recovers all 50 images. However, the images only display parts, usually starting in the top left corner. This is my current code. Can ...
0
votes
1answer
88 views

Pset4 Recover issues

I am having a number of problems with recover in pset4. First, my program is not finding a beginning of a jpeg. But, to test that, I have to first compile it, and I cannot because for some reason on ...
0
votes
1answer
46 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

pset4 recover only recovers 25 correct images

This is my code for recover. When I run the program, it gives me 25 successfully recovered photos. I don't know why it is only giving me half the required photos. I believe it might have something to ...
1
vote
1answer
25 views

pset 4 - recover, can't figure out mistake

I can't figure out what I'm doing wrong, please help! #include <cs50.h> #include <stdio.h> #include <stdlib.h> #define BUFFER_SIZE 512 int main(void) { // open memory ...
0
votes
1answer
423 views

recover.c “ recovered image does not match”

My program generated the 50 images (000 to 049) from the card.raw file. When I opened each one, it was just a checkered (which i assume is blank) image. I'm not getting a "unsupported image" error btw....
0
votes
1answer
24 views

Pset4 Recover Segmentation Fault Issue

I'm having an issue with my code, and I was hoping you could help! I keep getting a segmentation fault error, and I'm not sure why. I've ran valgrind and according to its findings, the issue seems to ...
0
votes
1answer
29 views

Typedef uint8_t BYTE returns unknown type name

My recover.c programme returns unknown type on the cs50 ide, but on a different IDE, it compiles but stops short at the if statement that checks if it is a valid jpg file. Then returns segmentation ...
0
votes
0answers
34 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
1answer
23 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
1answer
50 views

Stuck on recover

I am currently stuck on recover and cannot understand the fread function and how does it behave. I have watched all the shorts and explanations but i still don't get it. I also wasn't able to find any ...
0
votes
0answers
35 views
1
vote
2answers
44 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
50 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
48 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 ...
0
votes
1answer
38 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
0answers
26 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
47 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 != ...
-2
votes
1answer
54 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
37 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 <...
0
votes
1answer
137 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 ...