0

I have some fixed hex values to be updated to a binary file. I read the binary file using a hex editor and i found that it needs an updation programattically.

using (var stream = new FileStream(AsciifileName, FileMode.Open,    FileAccess.ReadWrite))
    {
        stream.Position = i;
        stream.WriteByte(arrayval);
    }

I tried using this but i couldnot manage the write as it is showing mis alignment.

I have a list with hexa values like

27 58 30 34 30 31 32 02

i want it to update at 2nd position as :

27 66 30 34 30 31 32 02

Is there somebody who is familiarized with this issue?.

**Steps needed **

  1. Convert an Binary to Ascii
  2. Update the Ascii file with my ascii values
  3. Convert back to binary
3
  • 4
    Possible duplicate of C# Replace HEX in binary file Commented May 17, 2016 at 8:27
  • This question has been asked many times Commented May 17, 2016 at 8:28
  • Is it the file contents that you want to change? I mean, is the goal just to change the file? Is it always the second byte (offset 1)? Commented May 17, 2016 at 22:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.