You are using
fseek()
within the loop so that the file position is always set to the same position before reading. That results in reading the same data 5 times.
You have to update the seek position too:
for(i = 0; i < 5; i++)
{
fseek(fp, u32FilePointer, SEEK_SET);
u16BytesRead = fread(u8Buffer, 1, 7, fp);
u32FilePointer += u16BytesRead;
printf("u32FilePointer : %lu\n" ,u32FilePointer);
}
When reading should always continue after the last read data, you can also move the
seek()
out of the loop:
fseek(fp, u32FilePointer, SEEK_SET);
for(i = 0; i < 5; i++)
{
u16BytesRead = fread(u8Buffer, 1, 7, fp);
printf("u32FilePointer : %lu\n", ftell(fp));
}