i am able to R/W a single byte but how do i R/W multiple

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sonic91
    New Member
    • Jan 2014
    • 3

    i am able to R/W a single byte but how do i R/W multiple

    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
    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();
            }
    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 :(
Working...