|
-
Aug 17th, 2009, 09:56 PM
#1
Thread Starter
Junior Member
Search for a hex byte in a file?
Hi, it's me again, sorry for asking another question, but I had made an app that opens a file and changes a hex byte then when I click another button it saves it.
I am now thinking of making an app that will change some hex bytes to something else, but the catch is that not every file will have some of the hex bytes that others will. Like I want it to search for 71, 13, 31, and 11, and change them to 15, but not all files will have say a 71 or some might not have a 13 or a 31... So I was thinking that I would need the app do a search for a hex byte in the file, is this possible? Thanks for any help!
Also, if there was a couple of bytes in a row that I needed to change, say F132, would I be able to search for all of that at once, and then change it to something like F133?
Last edited by iambowling247; Aug 17th, 2009 at 09:59 PM.
-
Aug 18th, 2009, 06:12 AM
#2
Re: Search for a hex byte in a file?
-
Aug 19th, 2009, 09:13 AM
#3
Re: Search for a hex byte in a file?
Have a look at the System.IO.BinaryReader and System.IO.BinaryWriter classes. You use the 1st to read the file in binary mode, and the later to write a file in binary mode. There are plenty of examples on using these classes in this forum. Just do a search and you should be able to get started.
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Aug 19th, 2009, 10:12 AM
#4
Re: Search for a hex byte in a file?
From what you stated, it also sounds like there is no shortcut to just plodding through the files. If there was any pattern to where things were found, there might be an easier search, but it sounds like there is no particular pattern.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|