//repead until end of card
while (fread(&buffer, MBLOCK, 1, sdCardFile) == 1)
//read 512 bytes into a buffer
fread(&buffer, MBLOCK, 1, sdCardFile);
So, why do you feel that it is necessary to read a second block before processing the first one? This has the effect of throwing away every other block from the input file. The first read in ...
What is wrong with feof?
per feof's man page, it returns non-zero if the EOF was already reached not whether the next thing to reach as you read is the EOF. this means that it returns non-zero even if there is no further data to read (in which case, if you read, you will reach the EOF).
as feof returns non-zero, the loop executes one more time and ...
I'm not getting a really clear picture of the problems you're having (no pun intended), but I'll tackle it anyways. First, you don't need to know how big the files are, just that their data will be in sequence in the input file. Once the code finds a block of data with a signature, that signals the beginning of a new output file. If one's already open, ...