I just need to replace the first 3 bytes, but the file was totally truncated. the other bytes were gone.
is there any simple way to do this? I don't want to read the hole file into buffer then get the replacement done and write back, because the file could be very large.