Presuming you're replacing a fixed number of bytes at a known byte offset with the same number of bytes, you can simply seek to that location and write over what's there.

If you want to write a different number of bytes than are present at that location, you'll need to read in at least the part of the file after that, so you can write it out again bumped over to the right place.