title: Trying to find a jpeg file in a raw file taken from a memory card with C
body: <p>Hi I am trying to find a jpegs inside a raw file</p>
  
  <p>I was told the beginning of each jpeg starts with either <br/>
   - 0xff 0xd8 0xff 0xe0 <br/>
   - 0xff 0xd8 0xff 0xe1</p>
  
  <p>So I am doing this:</p>
  
  <pre><code>// open input file 
  FILE* inptr = fopen("card.raw", "r");
  
  // create an array to hold info read from the memory card
  char buffer[512];
  
  
  int counter=0;
  int counter2=0;
  
  
  while ((fread(buffer, sizeof(char), 512, inptr)!=0))
  {
  
      if(buffer[0]==0xff)
      {
          counter++;
          printf("%2d - Found a jpeg!\n", counter);
  
      }
  
      else 
      {   
          //Just to test
          counter2++;
          printf("%2d - Nothing Found!\n", counter2);
      }
  }
  </code></pre>
  
  <p>But even though I am certainly sure there are some images there, the program is not finding anything.  Thanks in advance for your suggestions.</p>