Hello,
Im new to the site and was hoping some of you could help me,
I would like to be able to open a file locate a certain offset in that file and extract up to a certain part
the item type i would want to extract is PNG from offsets
171A
to
(This number is varied depending on what size the PNG is :S*)
so put simply
Open File > Read data > Extract (171A - (See Above*) > Save it as a PNG
Oh and if needed the image will always be 64x64
Thank you very much for any help!
13 2068
The FileStream object should accomplish what you need.
If "171A" is the value you are looking for, you can cycle through it until you find 171A and then start keeping track of what you read
if "171A" is the offset address then you can probably use the Seek() function to seek to 0x171A and then start reading/keeping track of what you read
Hey thanks for replying but im sorta new to these kinds of funtions maybe and exmaple? please,
Thanks
:( This is where im at
Dim asci As System.Text.Encoding
TOP: - Dim buffera(3) As Byte
-
asci = System.Text.Encoding.ASCII
-
Dim FSA As System.IO.FileStream
-
FSA = System.IO.File.OpenRead(OFD.FileName)
-
FSA.Seek(CONType, 0)
-
FSA.Read(buffera, 0, 3)
-
cnType = asci.GetString(buffera)
-
-
AuthOffset = &H171A
-
-
-
Dim author As String
-
Dim buffer2(2678) As Byte
-
asci = System.Text.Encoding.ASCII
-
Dim filestream2 As System.IO.FileStream
-
filestream2 = System.IO.File.OpenRead(OFD.FileName)
-
filestream2.Seek(AuthOffset, 0)
-
filestream2.Read(buffer2, 0, 2678)
-
author = asci.GetString(buffer2)
-
filestream2.Write()
-
filestream2.Close()
-
Anywhere close?
Is 171A the value you are looking for in the file, or an offset length?
Is 171A the value you are looking for in the file, or an offset length?
171A is the start of the "block" i want and the end of the block varies like i said im not sure how to specify what to look for to complete the block,
e.g.
1 file
(Offsets)
Start = 171A
End = 2190
2nd file
(Offsets)
Start = 171A
End = 20E1
Well then, once you open the file you would want to call:
myFileStream.Seek(0x171A, SeekOrigin.Begin);
That will put you at the correct offset to begin reading from. Now you can start reading the data and saving it somewhere
Know you said you don't know how much to read? Well I don't know what to tell you on that.
What type of file is it that you are opening? Maybe there is headered data somewhere?
Hey thanks for the reply so do i need any of that extra stuff do i simply add what you said to the OFD_FileOk ? well the reason i dont know where it ends is because it is an image and the image will sometimes vary in size as you will know
The file = CON File
Are you just wanting to read to the end of the file then?
If you don't know how much you need to read, i'm not sure how you are going to do this.
I've never heard of a CON file?
CON, Configuration file, Simdir
CON, MSTS Consist file, MSTS
Hmm its ok then i will have to postpone i guess thanks for the help!
Regards,
Silly
Hmm its ok then i will have to postpone i guess thanks for the help!
Regards,
Silly
On seconds thoughts if you could maybe show me how if the end offset was
2190
Thanks
Ok, I'll show a quick example of how things COULD be done.
Given:
Start = 0x171A
End = 0x2190 -
int Start = 0x171A;
-
int End = 0x2190;
-
int lengthtoRead= End - Start;
-
FileStream fs =new FileStream("SomeFile.Com");//you made need to use an overload to support seek
-
fs.Seek(0x171A, SeekOrigin.Begin);
-
byte[] buff = new byte[lengthtoRead];
-
int ActualAmountRead = fs.Read(buff,0,buff.Length);
-
//now if ActualAmountRead is = lengthtoRead, then you have all your bytes in a nice byte[]
-
Thank you very much you have been so much help and i greatly appreciate it!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Nazgul |
last post by:
Hi!
I want to implement a small tool in Python for distributing "patches" and I
need Your advice. This application should be able to package all files
chosen by a user into a self-extracting.exe...
|
by: Avi |
last post by:
hi,
Can anyone tell me what the problem is and how to solve it
The following piece of code resides on an asp page on the server and
is used to download files from the server to the machine...
|
by: Michael Hill |
last post by:
Hi, folks.
I am writing a Javascript program that accepts (x, y) data pairs from
a text box and then analyzes that data in various ways. This is my
first time using text area boxes; in the past,...
|
by: nephish |
last post by:
Hey there,
i have a text file with a bunch of values scattered throughout it.
i am needing to pull out a value that is in parenthesis right after a
certain word,
like the first time the word...
|
by: Tony Clarke |
last post by:
Hi All,
I have been trying to extract data from a text file using the fscanf()
functions and sscanf() functions. The file is of various characters and
integers separated by semicolons, the...
|
by: Terry Olsen |
last post by:
Ok, now that I've got my disk imager program working, I'd like to attach a
"self-extractor" to the front end of the image file and make it a
self-extracting disk image executable file. The idea...
|
by: Werner |
last post by:
Hi,
I try to read (and extract) some "self extracting" zipefiles on a
Windows system. The standard module zipefile seems not to be able to
handle this.
False
Is there a wrapper or has...
|
by: poolboi |
last post by:
hi guys
i've having some problem extracting data from a text file
example if i got a text file with infos like:
Date 2008-05-01 Time 22-10
Date 2008-05-01 Time 21-00
Date 2008-05-02 Time...
|
by: Andy B |
last post by:
I need to count files in a certain directory that has the string -Contract
Template.xml at the end of it. How would I do this?
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |