Questions tagged [pset4recover]
The pset4recover tag has no usage guidance.
132
questions
0
votes
1
answer
16
views
pset4 recover error segmentation fault
Can i please get some help with my recover code? i have rewritten it so many times but i still get a segmentation fault
i even unmalloc'd a few things but to no avail
// recovers deleted images
#...
1
vote
1
answer
18
views
pset4 recover segmentation fault on code that compiles, I have looked many questions related to the problem but no luck so far
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <cs50.h>
typedef uint8_t BYTE;
const int BLOCK_SIZE = 512;
int main(int argc, char *argv[])
{
if (argc != 2)...
0
votes
1
answer
26
views
Recover: Encountering many problems
My code compiles fine, but no jpg files are created. It seems like the condition that checks for the start of a jpg is never true, so the body of that if condition never executes.
I'm also having ...
0
votes
1
answer
11
views
Recover code runs but doesn't generate any jpegs
at sure I didn't know how to even begin, but slowly started realizing how i can tackle this problem. after a bit i was stuck on how some stuff works so i looked up some recover tutorials that helped ...
0
votes
1
answer
45
views
Code compiles but files are not read. Recover pset4
Trying to find the problem i could track it to the else statement where
""printf("Could not open file because NULL.\n");"" is located. The files are not read at all or ...
0
votes
1
answer
42
views
pset4 recover doesn't recognize jpegs
I've been working on Recover for quite many hours now and I can't really understand what is wrong.
Here I share my commented code.
What I can tell you about its behavior is the following:
It does not ...
0
votes
1
answer
55
views
pset 4 recover, I can compile but no JPEGs returned
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
typedef uint8_t BYTE;
int main(int argc, char *argv[])
{
if(argc > 2 || argc < 2)
...
0
votes
1
answer
67
views
CS50 PSET4 recover Segmentation Fault
Can someone point out why this code is resulting in segmentation fault?
It's a code for the 'recover' question in pset4, cs50.
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h&...
0
votes
1
answer
44
views
Pset4 recover produces only 2 corrupted iamges
I am at Pset4 recover pset. When I run my code, it produces only 2 corrupted images
here is my code :
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
typedef uint8_t BYTE;...
0
votes
1
answer
106
views
PSET4 Recover error: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *
I am at PSet4-recover. I can't compile code properly.
Always get these errors :
recover.c:47:31: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-...
0
votes
1
answer
48
views
(PSET 4 - Recover) Why is first recovered image blank?
I am on problem set 4 recover and I have nearly completed it. I have written my code and it compiles but when I run it on the card.raw file it appears to recover all the 50 photos except the 1st one ...
0
votes
1
answer
34
views
CS50 Recover recovering corrupted images, and only 43 images
I'm attempting to solve the Recover problem, and I'm using a for loop to go through the bytes of the raw file. It spits out 43 images, some of which have the full image, but most are corrupted, and ...
0
votes
1
answer
37
views
PSET4 RECOVERY does not recover images correctly
I have started working on PSET 4 RECOVERY. My program compiles successfully, it goes through the first 3 tests no problem, but for the love of me I cannot seem to find the problem.
It just does not ...
0
votes
1
answer
41
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
1
answer
16
views
In Recover, when I run check50, it says timed out while waiting for program to exit. But when I run it with ./recover card.raw, it works perfectly
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
typedef uint8_t BYTE;
int check_jpg(BYTE array[]);
int main(int argc, char *argv[])
{
if(argc != 2)
{
...
0
votes
1
answer
30
views
pset 4 Recover: Segmentation Fault in If-else-statement
I am trying to solve why I get a segmentation fault in my code "recover". It's right at the end of the file. I solved the pset4 by trying different solutions. However, I don't understand why ...
0
votes
1
answer
80
views
Why can't I assign the return value of a fwrite() function to another variable? Infinite loop
In 'recover' I wanted to jump out of my while loop if the fwrite() function of the last photo (of the file) returns a value < 512 (indicating that the last photo or end of file is reached). I ...
0
votes
1
answer
319
views
cs50 2021 pset4 recover help
EDIT: Ok after trying for 3 hours after posting this I have finally managed to solve this pset. The problem wasn't actually a logical one but rather it was a problem with the type definition and the ...
0
votes
1
answer
15
views
Segmentation Fault in recover.c
I keep getting a segmentation fault in my recover.c and I am not sure why. I have been stuck on this one for days. The idea is that we are trying to recover some deleted jpg files from a card.
Thank ...
0
votes
1
answer
67
views
Need Help with using malloc and PSET4 Recover
I cannot tell what's wrong with my code. When using check50 I keep getting the results below:
:) recover.c exists.
:) recover.c compiles.
:) handles lack of forensic image
:( recovers 000.jpg ...
0
votes
1
answer
33
views
buffer array full of \000, pset 4 recover segfault
I am experienceing a problem where nothing is beign read into a buffer array, but for the life of me I am unable to figure out why. I have read through other threads with users experiencing the same ...
0
votes
1
answer
37
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
1
answer
67
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
1
answer
50
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
1
answer
56
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
1
answer
21
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
1
answer
57
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
1
answer
37
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
1
answer
56
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
1
answer
37
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
1
answer
35
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
1
answer
77
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
1
answer
55
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
1
answer
46
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&...
1
vote
1
answer
32
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
1
answer
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
1
answer
217
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
1
answer
25
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
1
answer
24
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
1
answer
82
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 ...
1
vote
2
answers
46
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
1
answer
51
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
1
answer
53
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
1
answer
43
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
1
answer
79
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
1
answer
39
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
1
answer
78
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
1
answer
28
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;
...
0
votes
0
answers
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
2
answers
70
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 != ...