I've been struggling with this for a while. After reading other posters questions and reading the responses I've managed to come up with code that compiles and works correctly only if the value of 'n' entered by the user is a multiple of 4.
The area I am least confident in my code is the usage of fseek. Another poster on the site had used SEEK_SET rather than SEEK_CUR and I borrowed that for my code. I believe I understand how and why it works, but I didn't come up with it myself and I wonder if this could be contributing to my problem somehow?
As for the problem, I think it's a padding issue but I've gone over my code and all of the padding to outfile seems to be within the correct loops. Can anyone point me in the right direction?
My code can be found here