Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 13557

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.

0 votes

Pset4 recover.c: file limit exceeded

I'll start giving you a hint to fix the easy part. This loop will never trigger: while((fread(&block, sizeof(block), 1, card)) != 1) Because fread() will return the number of elements successful …
Yuri Laguardia's user avatar
1 vote
Accepted

pset 4 images recovered but with weird workaround

I can't see the value of the constant BLOCK, but I imagine it's 512. What happens when you do sizeof(512)? Remember that 512 is an integer. It's a different result than what you're expecting. I think …
Yuri Laguardia's user avatar
1 vote
Accepted

Why does my second while loop finish before the first image is complete?

I won't review all the code for now, just give you a critical information so that maybe you can solve the problem yourself. It's not my place to teach boolean logic, so you'll have to study it by you …
Yuri Laguardia's user avatar
2 votes
Accepted

pset4 recover only 24 wierd looking images recovered

while(fread(&buffer, sizeof(buffer), 1, file) == 1) // should be less than two when eof is reached { fread(&buffer, sizeof(buffer), 1, file); You're calling fread() two times in a row. You may t …
Yuri Laguardia's user avatar
1 vote
Accepted

recover.c. basics. How do I get started with fread?

You're on the right track. You don't need to malloc()... it can be done with an array just like you declared... now you fread() 512 bytes into that array and check the first four bytes with temp[0], …
Yuri Laguardia's user avatar
1 vote
Accepted

Pset4 recover.c compliles but can't open jpeg

Are you sure this code is recovering all 50 jpgs? It seems to me like you're missing half the files and only recovering 25 pics, because you're calling fread here: fread(buffer, sizeof(BYTE)*512 , 1 …
Yuri Laguardia's user avatar
1 vote
Accepted

PSET 4 - Recover.c only recovering one empty file

infile is a string, it's content is the expression "card.raw". So what exactly is this loop supposed to accomplish? for (int i = 0; i < *infile; i++)
Yuri Laguardia's user avatar
1 vote
Accepted

PSET4 Recover Fails check50 :( recovers 000.jpg, middle file, last file / killed by server

Your code reads and recovers the entire content of card.raw, but you're supposed to recover only the jpg files inside it. …
Yuri Laguardia's user avatar
1 vote
Accepted

Code Seems Correct but Output is garbage

When the program has opened the card.raw file and is reading into the buffer, once the program has completed one loop iteration, how does it know to read the next block of bytes and not just t …
Yuri Laguardia's user avatar