I've been itching at this code for hours now, it doesn't output any images, everytime i try to debug it it comes to the first while statement and immediatly returns 0, i have no idea why
int main(int argc, char* argv[])
{
int firststar=0;
int jpgcount=0;
unsigned char buffer[512];
FILE* inptr = fopen("card.raw", "r");
while(fread(buffer, 512,1,inptr) == 1)
{
if(buffer[0]== 0xff && buffer[1]== 0xd8 && buffer[2]== 0xff && (buffer[3]==0xe0 || buffer[3]==0xe1))
{
char title[9];
sprintf(title,"%d.jpg",jpgcount);
FILE* outptr = fopen("title","a");
fwrite(buffer,512,1,outptr);
firststar=1;
jpgcount++;
do
{
fread(buffer, 512,1,inptr);
fwrite(buffer,512,1,outptr);
} while(buffer[0] != 0xff && buffer[1] != 0xd8 && buffer[2] != 0xff);
fclose(outptr);
}
}
fclose(inptr);
}