I am writing a file in binary using fwrite. I am opening this file for read and write. After each write, the file pointer points to the end of the file, and I need to be able to read backwards x number of bytes.

I could move the pointer backwards X bytes, and then do a forward read (I would prefer this way), but I'm not sure how to do this either.

Any suggestions?