VB - APP - Extract Block From Hex File?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sillybob123
    New Member
    • Nov 2008
    • 12

    VB - APP - Extract Block From Hex File?

    Hello,

    If possible can anyone show me how to extract a block of data from a hex file
    i would like to extract from offset: E000 to simply the end of the file

    thanks
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Just like before


    [code=c#]
    //
    //
    int Start = 0xE000;
    FileStream fs =new FileStream("Som eFile.Com");//you may need to use an overload to support seek
    int End = fs.Length;
    int lengthtoRead= End - Start;
    fs.Seek(Start, SeekOrigin.Begi n);
    byte[] buff = new byte[lengthtoRead];
    int ActualAmountRea d = fs.Read(buff,0, buff.Length);
    //now if ActualAmountRea d is = lengthtoRead, then you have all your bytes in a nice byte[]
    //
    //
    [/code]

    Comment

    • sillybob123
      New Member
      • Nov 2008
      • 12

      #3
      ok but which bits am i to fill in etc...
      + i cant seem to get it to work lots of errors etc...

      sorry about this

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        I suggest you go read up on the FileStream object in MSDN for information about it.
        What i posted was all relatively low math and code usage.

        Comment

        Working...