none
How to make a program that can add,delete and replace Hex bytes? RRS feed

  • Question

  • Hi, I'am a new comer here and i hope i get a help from you guys i want to know ......

    How to make a program that can add,delete and replace Hex bytes?

    Thanks i will appreciate your answers for ever !!!!!  

    Saturday, August 16, 2014 4:37 PM

Answers

  • I don't know if you want to do this in Small Basic. If yes, use the following testprogram:

    StartString="1a2b3c4d5e6789fff"
    TextWindow.WriteLine(StartString)
    
    'to add a byte "2"  after position 4
    NewString=Text.Append(Text.GetSubText(StartString,1,4),"2")
    NewString=Text.Append(NewString,Text.GetSubTextToEnd(StartString,5))
    TextWindow.WriteLine(Newstring)
    
    'to delete the fifth byte in NewString
    SecondString=Text.GetSubText(NewString,1,4)
    SecondString=Text.Append(SecondString,Text.GetSubTextToEnd(NewString,6))
    TextWindow.WriteLine(SecondString)
    
    'to replace the second byte in StartString By a "f"
    NewString=Text.Append(Text.GetSubText(StartString,1,1),"f")
    NewString=Text.Append(NewString,Text.GetSubTextToEnd(StartString,3))
    TextWindow.WriteLine(Newstring)
    


    Jan [ WhTurner ] The Netherlands

    Saturday, August 16, 2014 5:35 PM
    Answerer