How big is the file?

You have to remember, on the last 32b chunk that it may not be 32b it could be say 29b (if there are 29b left in the "read" file. And you'll then write 29b + 3b (of rubbish) to the new file and they'll differ. Also if you run out of stuff to read after the first 10 calls, then you'll end up writing 32b of the 10th call (buffer) to the "write" file.

Check the return result of fread() and call fwrite() accordingly. Perhaps even control your loop in such a way that it's based on the fread() result so you stop reading when there is no more stuff to be read.