i have finally figured out how to read to a text box and write back to the file but i can only do it a byte at a time
this is my read and write code
but i need this to read and write from offset 0x83 to 0x8f i also need to do this read and write with ancii for the same length just a different area but i dont know where to start with that.
Please help its making me go gray :(
this is my read and write code
Code:
private void btnRead_Click(object sender, EventArgs e)
{
fs = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
br.BaseStream.Seek(0x83, SeekOrigin.Begin);
byte b = br.ReadByte();
br.Close();
textBox1.Text = b.ToString("X2"); // display in hex
}
private void btnwrite_Click(object sender, EventArgs e)
{
byte b = Convert.ToByte(textBox1.Text, 16);
fs = File.Open(ofd.FileName, FileMode.Open, FileAccess.Write);
BinaryWriter bw = new BinaryWriter(fs);
bw.Seek(0x83, SeekOrigin.Begin);
bw.Write(b);
bw.Close();
}
Please help its making me go gray :(