28 then have your tf email your albums url to

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: r; they should still be viewable. Now, I only have one CF card, but there are a whole lot of you! And so I’ve gone ahead and created a “forensic image” of the card, storing its contents, byte after byte, in a file called card.raw in /home/cs50/pub/share/pset5/. So that you don’t waste time iterating over millions of 0s unnecessarily, I’ve only imaged the first 6.1 MB or so of the CF card. Since youre only going to be reading it, you don’t need your own copy of this forensic image. (Might as well save space!) Simply open our copy with fopen via its full path, as in the below.25 FILE *fp = fopen("/home/cs50/pub/share/pset5/card.raw", "r"); You should find that this image contains 50 JPEGs, each of which is between 8 KB and 200 KB in size, give or take. Notice, incidentally, that ~/pset5/jpg/ is empty. It’s up to you to create, at least, a recover.c for this program. (We leave it to you to decide how to compile it.) For simplicity, you may hard ­ code the path to card.raw in your program; your program need not accept any command ­line arguments. When executed, though, your program should recover every one of the JPEGs from card.raw, storing each as a separate file in your current working directory. Your program should number the files it outputs by naming each ###.jpg, where ### is three ­digit decimal number from 000 on up. (Befriend sprintf.) You need not try to recover the JPEGs’ original names. To check whether the JPEGs your program spit out are correct, simply SFTP them to your own desktop, double ­click, and take a look.26 If each photo appears intact, your operation was likely a success! 25 It’s fine to hard ­code this path into your program rather than define it as some constant. To SFTP files means to transfer them (e.g., from your cloud account to your own desktop) via an SFTP client, a program that “speaks” a protocol known as SFTP. Mac users should download CyberDuck under Software on the course’s website; PC users should download WinSCP from the same. (Though you are welcome to use other clients as well.) Instructions for both clients can be found under Resources on the course’s website. 26 13 < 16 This is CS50. Harvard College Fall 2010 Odds are, though, the JPEGs that the first draft of your code spits out won’t be correct. (If you open them up and don’t see anything, they’re probably not correct!) Execute the command below to delete all JPEGs in your current working directory.27 rm *.jpg If you’d r...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online