I've gotten recover
to work... sort of. The problem is difficult to describe without posting my code, but here's an attempt:
My program can find all the jpg signatures (in GDB, my jpeg-finding line returns yes each time) but it only creates 2 jpg files, both of which are viewable images. The first file seems fine but the second contains all of the rest of the data to EOF
.
From trying to debug in GDB, I believe the problem is in the implementation of my file naming scheme. The first file is called correctly called 000.jpg
and the second file is correctly called 001.jpg
(hooray!) but when it comes time to create the third file, it also calls that one 001.jpg
and thus just appends the new jpg to the old jpg file.
I'm creating the filenames with sprintf
, using a counter that is initially set to 0
like this:
int counter = 0;
and incremented after the previous filename is created, like this:
counter++;
Then I tried initializing the counter to 5
instead of 0
. That resulted one jpeg named 005.jpg
and a second one called 001.jpg
so it seems that when I increment the counter it only ever sets the counter equal to 1
.
Give that limited information, anyone have an idea what's going wrong?