file size limit exceeded/corrupted jpgs on recover
So I've managed to get a semi-working code for recover
basically it's
//open card file (hard coded)
//make var for keeping count of jpg
//declare a BYTE as an unsigned 8 bit int
//declare an array called buffer of size 512 BYTEs
//declare a second buffer to break the while loop
//declare a FILE pointer called img to write the buffer data into
//declare a char array (photo) of size 3 to contain the
//resulting 3 char 'xxx.jpg' string to sprintf to
//do while true
//read 512 chunks of file into buffer
//subscript the first 4 BYTEs and check if they are that of
//a jpeg
//if the jpg counter is > 0, meaning we've already
//started writing jpegs
//close img file
//sprint a new jpeg photo name
//open that jpeg photo name and bind to img pointer
//write current 512 block in buffer into img
//increment jpg counter +1
//else if above is false and jpg counter > 0
//write current 512 byte block in buffer into img
//else if fread of second buffer returns a 1 meaning
//we've reached the end of file
//break out of the loop
The first problem is that I only get 40 files. The last of which, 039.jpg, I can't actually open because it is massive 536870912 bytes which is bigger than the allowed 8MBs.
The second one is that if I try to open the files to take a look at them, I see assembly code. Or at least what I assume is assembly code with pink looking lines and white question marks inside a black diamond. They are not an actual jpg file.
The third issue is that if I list the items in my terminal, they appear with a trailing question mark, i.e. 000.jpg? 001.jpg? etc. If I try to delete them by rm -f *.jpg it says that there is no current such file in my directory, even though I can clearly see them listed there.
I am also unable to view the file headers using xxd because like I said before, I can't actually access the files since according to the terminal, they don't exist.
I appreciate any help I can get.
Posted Aug 29, 2016, 11:05 PM UTC