I have been working on the "recover", however although it compiles but it tend to run into an infinite loop when searching for the start of the jpgs. Here are my coding for searching the start of the images:
//finds beginning of jpg file
do //if not jpg
{
fread(&buffer, sizeof(buffer), 1, inptr);//read another unit
fseek(inptr, +sizeof(buffer), SEEK_CUR);
printf("loading...\n");
}
while (isjpg(buffer) == 1);
//find jpg funtion
int isjpg ()
{
unsigned char buff[512];
if (buff[0] == 0xff && buff[1]==0xd8 && buff[2]==0xff && (buff[3] == 0xe0 || buff[3] == 0xe1))
{
return 0;
}
else return 1;
}