0

After reading a few submissions for help here and in the subreddit, People have told me there should be 50 files in the memory card. I have made a loop that correctly reads the file, but as soon as I pass it through the first test of new files I get less than expected (16 to be exact), is there something wrong with my fread loop.

Here's the code:

    byte buffer[512];

    while (fread(&buffer, 512, 1, file) == 1)
    {
        if (buffer[0] == 0xe0)
        {
            printf("yay\n");
        }
    }
}

Thank you in advance

1

The first byte of the signature block is 0xff, not 0xe0. You should code to find all 4 initial bytes to verify that you're finding the correct number of files, not just the first byte.

You must log in to answer this question.

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