Results 1 to 3 of 3

Thread: Need example how to Open/ Read/ Save Hex file please...

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2020
    Posts
    1

    Need example how to Open/ Read/ Save Hex file please...

    Need example how to Open/ Read/ Save Hex file please...

    I have 2 diferent files. (.bin)
    I need some Hex data coppy from file2 and replace to file1, but need save as file3.
    I need to use Open and Save file dialogs.

    Button1 (Open_file_1) - I need Open file1
    Button2 (Open_file_2) - I need Open file2 and read Hex from address 1C000 to 1C0FF
    Button3 (Save_file_3) - I need Create a new file (same as file1), Replace readed Hex from file2 in same address 1C000 to 1C0FF and save it.

    Thank you!

  2. #2
    Fanatic Member Peter Porter's Avatar
    Join Date
    Jul 2013
    Posts
    532

    Re: Need example how to Open/ Read/ Save Hex file please...

    What we need is for you to try to code this first. You can find plenty of examples thru Google, just make sure you also include the programming language you're using.

    If you're programming with VB, also search for C# examples and translate that to VB with this site: https://converter.telerik.com/

    If you get stuck along the way in writing this program, show us your code, and we'll help you out.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Need example how to Open/ Read/ Save Hex file please...

    There is no such thing as a "hex file". There are hex editors that display the data from a binary file in hexadecimal form because that form is more user-friendly, but the file itself just contains bytes. The reason hexadecimal is a useful way to visualise binary data is that every byte can be represented by a two-digit value, but that doesn't mean that the file actually contains those two-digit values. Each byte is actually stored in binary, not hexadecimal or even decimal.

    So, basically, you are asking how to read some bytes from one file and write them to another. Unless you are editing them manually, there's no hex involved. It is very easy to find information on reading and writing files so you should make an effort to do so. Research as best you can, put the information you find to use as best you can and then, if you encounter an actual issue along the way, post a question here about that issue specifically. You're asking about a multi-step process so any valid question must involve a single step only. For instance, you can work out how to use an OpenFileDialog and a SaveFileDialog completely independently of anything to do with binary files, so there's no good reason to be asking about both in the same thread.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width