Sure it can. The following code opens a file, gets the byte at position 87, checks if it is the letter A and if it isn't sets it to the letter A. Check out these I/O functions in your help file - Open, Get, Put, Seek (statement), Seek (function), LOC, LOF, Close
Opps - misread the original request. I thought hacker was refering to memory blocks (assembler background kicked in) not files. Apologies for the bum steer.
David
Learn the Rules so that you know how to break them properly.
First off, I am terribly sorry for bringing up a topic thats been buried for 3 years. But I couldn't find any others on my question.
My question is that is there a way to select a region like &H420 to &H430 and check for the things in there and edit it at once? Along the lines of something like:
Code:
Dim lngFileNo As Long
Dim bytData As Byte
lngFileNo = FreeFile
Open FileName For Binary As lngFileNo
Get lngFileNo, &H3A7E3, bytData
If bytData <> &HD Then
Put lngFileNo, &H3A7E3, &H0
End If
Close lngFileNo
Get all the bytes in the range and put them into an array.
Code:
Dim bytData() as Byte
Redim bytData(&H430 - &H420)
Get lngFileNo, &H3A7E3, bytData
'code to check and change bytData array
'now overwrite the existing data in the file
Put lngFileNo, &H3A7E3, bytData
Just be careful when working with binary files at the byte level. If anything is incorrect the file could become "corrupt"...
ah thank you so much for the quick reply
but i have 1 more question, is there a way to put together &H and a variable i want to do &H & var & but it just wont work :S
First off, I am terribly sorry for bringing up a topic thats been buried for 3 years. But I couldn't find any others on my question.
My question is that is there a way to select a region like &H420 to &H430 and check for the things in there and edit it at once? Along the lines of something like:
Code:
Dim lngFileNo As Long
Dim bytData As Byte
lngFileNo = FreeFile
Open FileName For Binary As lngFileNo
Get lngFileNo, &H3A7E3, bytData
If bytData <> &HD Then
Put lngFileNo, &H3A7E3, &H0
End If
Close lngFileNo
Next time we'd prefer if you started a new thread.