summaryrefslogtreecommitdiff
path: root/wk4/pset/recover/recover.c
diff options
context:
space:
mode:
authorFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-04-04 07:14:15 +0000
committerFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-04-04 07:14:15 +0000
commit6173b0fbcead11ef14c779220b67dc830917f4b7 (patch)
tree3c5c67393642a57663d7255d2fac1c3ea048eda5 /wk4/pset/recover/recover.c
parent1c3ebcd88e9bc4c2e3bc81e3ebf1947757432b26 (diff)
Thu, Apr 4, 2024, 12:14 AM -07:00
Diffstat (limited to 'wk4/pset/recover/recover.c')
-rw-r--r--wk4/pset/recover/recover.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/wk4/pset/recover/recover.c b/wk4/pset/recover/recover.c
index b5e5b41..96d78b6 100644
--- a/wk4/pset/recover/recover.c
+++ b/wk4/pset/recover/recover.c
@@ -23,13 +23,21 @@ int main(int argc, char *argv[])
/*
for (file length) {
- if (first 3 bytes are 0xff 0xd8 0xff AND 4th byte is 0xe* (* denotes anything)) {
+ if (first 3 bytes are 0xff 0xd8 0xff AND 4th byte is 0xe* (* denotes anything))
+ {
this is a photo; remember the pointer
- look through the blocks ahead of this one for a new photo
- for (file length left) {
- add
- if (first 3 bytes are 0xff 0xd8 0xff AND 4th byte is 0xe* (* denotes anything)) {
- the
+
+ // look through the blocks ahead of this one for a new photo
+ for (file length left)
+ {
+ add 1 to photo length
+ if (first 3 bytes are 0xff 0xd8 0xff AND 4th byte is 0xe* (* denotes anything))
+ {
+ this is the photo length
+ break
+ }
+ }
+
}
}