1

I checked the boards and couldn't find if anyone else had the same issue.

For some reason, Recover runs 'seemingly' correctly when I ask it to and I see the pictures in the folder from "000.jpg" to "049.jpg". I'm even able to double click them and see them without issues. Was able to see the content of all 50 images.

The problem is check50 was failing. When I accidentally was trying to view the contents of the folder using 'ls', it showed:

000.jpg? 011.jpg? 022.jpg? 033.jpg? 044.jpg? 001.jpg? 012.jpg? 023.jpg? 034.jpg? 045.jpg? 002.jpg? 013.jpg? 024.jpg? 035.jpg? 046.jpg? 003.jpg? 014.jpg? 025.jpg? 036.jpg? 047.jpg? 004.jpg? 015.jpg? 026.jpg? 037.jpg? 048.jpg? 005.jpg? 016.jpg? 027.jpg? 038.jpg? 049.jpg? 006.jpg? 017.jpg? 028.jpg? 039.jpg? card.raw 007.jpg? 018.jpg? 029.jpg? 040.jpg? core 008.jpg? 019.jpg? 030.jpg? 041.jpg? recover 009.jpg? 020.jpg? 031.jpg? 042.jpg? recover.c 010.jpg? 021.jpg? 032.jpg? 043.jpg?

What I'm doing in my code is this:

  1. Open card.raw

  2. I have: while(1) so it basically keeps on looping unless I break.

  3. I then do the following to make sure I was able to read the data:

    size_t data = fread(buffer,512,1,inptr); //check for beginning of JPEG if(data != 1) { break; }

  4. If the code was reading correctly I would still be in the loop, so I check if the first four bytes are those of the jpg signature bytes.

  5. If they are indeed signals of the start of a new jpg, I check if I have another jpg open (the previous jpg) and if so, I close it and create a new file incrementing the jpg count. If it wasn't a new file, then I write to the already open image file

  6. After I break out of the loop eventually, I check if an image file is still open and I close it.

  7. Finally I close "card.raw" and return 0.

Any help is greatly appreciated as I'm really stuck on this.

1 Answer 1

3

Your pseudocode seems like it should work.

Is the issue your jpg filename? Is the filename a char[8] array?

1
  • 2
    Thanks! I had totally forgotten about the fact that the last character would need to be \0 and increasing the number of characters in the filename array helped.
    – user81
    Commented Sep 12, 2014 at 22:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .