how do i write to a overwrite a specific byte in a binary file? i looked around, but i couldn't figure it out.
i figured out how to write to the file, but it write it at the
beginning of the file, is there anyway to write it in the middle of the
file? or a specified location?
C# writing to a specific byte in a binary file
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Mike GoldRank #50 · 30.6K pointsPosted Aug 15, 2007, 7:47 PM EDT
I think you just need to open the file using the FileStream class for writing, set the Position property you want to write to, call
myFileStream.Position = 121;
or you can call Seek
Then to write to the file
public override void Write ( byte[] array, int offset, int count )