Hi David,

I don't know for certain, but try to google the scripting.filesystemobject
and look at it's methods.  if nothing else, you could use the readAll method
to get the file into a string, and use the mid() function to extract
specific bytes.

hth,

Chip



-----Original Message-----
From: David [mailto:[email protected]] 
Sent: Tuesday, November 24, 2009 4:46 AM
To: Scripting List WE
Subject: Reading from a file - how to?

Ok, I know, how to open, and close a file.
 
My task:
I need to open a file, go to byte X, and read a given numbers N of bytes. In
other words, as an example:
Open the file,
Goto byte 442,
Read 34 bytes into a string,
Do something with the string,
Write it back to the file from byte 442, close the file.
 
My Question:
Is there an easy way, to jump directly to a given position inside a file,
and is there an easy way to read a certain amount of bytes, into a string
(or maybe even better an array)?
 
I am using VBS. And, I guess, due to compatibility issue, it's best to
operate a BINARY file (not open it as a text file, since it is not a
textfile in question)?
 
Thanks,

Reply via email to