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 answers only not deleted user 2632

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.

3 votes
Accepted

How do I add leading zeros to the filename in `recover`?

To print 000 you have to specify the format in the place holder. for printing should be something like this: printf("%03d", 0); but to create a file with the name 000.jpg i think you need to use t …
wallek876's user avatar
  • 1,399
4 votes
Accepted

recover.c cannot detect jpeg signatures?

Your program is not recovering the images because the cs50 appliance or linux in this case uses the little-endian convention to store or read the data. I really don't know very much about this myself, …
wallek876's user avatar
  • 1,399
2 votes
Accepted

fread not putting what I expect in buffer

The problem is that you are not printing using the same format in gdb and with the xxd command. xxd outputs hexadecimal and gdb outputs in decimal. To print in the same format with both programs a so …
wallek876's user avatar
  • 1,399