Vbscript reading binary files
Read Stream. What does now work? Is there an error message. It 's late so i can't try it. I become back 0x3F 0x3F 0x3F 0x3F.. The goal is to read a binary file in a var and post the contents to a Java Applet. If I use the first methode and I read a binary file I become for the values 0x81 ,0x8D, 0x8e, 0x8f, 0x90, 0x9d and 0x9e always the value 0x3F back.
How late is by you?? I don't know why. Close ' TypeName produces Byte but it is really a byte ' array inside a string. I found an other solution for the problem. I convert the binary file in an hex file read this file with the first methode openTextFile and convert them in the Java App. This is not the best solution but this will work fine. If not, no problem. Few photons and electrons were injured in the creation of this forum posting. Anyone can write a loop that reads in data and writes out binary with such functions.
This was kind of like reinventing the wheel I guess. Thanks for your response. I think a detailed explanation may be helpful.
Let's go through an example that may make it clear the importance of not treating numerical data as a string. I have two options to write that number to a file The BinaryToString and StringToBinary will treat this as 11 bytes so the file size is larger but admittedly dependent on the number of characters in the number.
The file size could potentially be smaller if the numerical data on average was made up of numbers from -9 to 99 remember, still need a 1 char deliminator. But that's not the real problem. After reading in this data as a string you still need to convert this string to a number so that it can be used in mathematical calculations. The string is of no value for calculations.
That requires several steps with a computational penalty for each step. For every data point I read in binary as a string I first have to use BinaryToString to get the data in string format, I then have to use StringSplit to separate the large string into individual strings for each number and finally I have to use the Number algorithm to convert the string into a number.
When you have millions of data points this is very slow and unnecessary. Much better to write the data in binary as an Int32, Int64 or Double and read it in binary as the same data type. But for large datasets the time savings in reading these files in the way I outlined is significant. I didn't misunderstand you--there are other functions to change string to int or floats too before writing out to binary.
I understand what you are doing but it can be done other ways, but whatever--you do your thing. Based on this naive response, you have made everyone on this forum who knows the depth of jchd's technical knowledge laugh. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W.
How to get your question answered on this forum! Well maybe jchd's technical knowledge is good but communication skills could use some work.
Earthshine, actually I think there is still some misunderstanding I am not converting strings to int or floats before writing out to binary. My data is already in int and float format in the computer memory as that is the form I need it in to do computations.
I just want to write it out in that format without going through a string in the process as that is an unnecessary and computationally expensive step. If I'm re-inventing the wheel then I and I suspect many others have missed the posting of the wheel somewhere on this forum or in the help files.
Please tell me where you've hidden the wheel. I for one would use your code. I must apologize for my cryptic answer, hastily writen.
It wasn't meant to be rude to you, just pointing out that such code isn't a valuable, efficient solution. I feel this now turns out as a code optimization request, rather than a failed demo that plain vanilla code is inferior. I gently suggest you open a new thread in General Help forum with a significant sample of input data and your requirements for processing.
I strongly suspect there are faster regular ways to process text ASCII data than convert the wole thing to binary then extract the wanted pieces out of a large chunk of converted binary. The goal of most of the fora here is to maximize usefulness of AutoIt-based code.
So we're fully spot-on and there is a number of seasonned contributors here willing to provide as much help as possible.
I'm actually not requesting any code optimization. I'm also not suggesting the plain vanilla code is inferior. Autoit is an incredible tool as is. I was just trying to contribute some code that other programmers might find helpful. I'm certain you could make autoit read ascii files faster with some tweaking but it won't compete with reading the same data in binary format. It's simply impossible to do when you have to convert one using several steps and you don't have to convert the other.
So I would not submit anything to the General Help forum that I know has no chance at success. Tagged as VBScript. Stats VBScript to read binary files and load data into Excel - Life in the old dog yet. Please Sign up or sign in to vote. VBScript may be old and ugly, but there are some quick and dirty tricks for which it is still really handy. Why bother? Here is a function which does that very thing: VBScript.
Copy Code. I am honoured to work in a team developing new compiler and runtime technology for Micro Focus. My past includes a Ph. Download jsbin. I've looked at FSO but it only seems to support reading text files. How else can I read a binary file short of developing my own component? I'd really appreciate any help. Reading the Binary file using FileSystem Object. Reading binary registry values using regobj.
Reading binary file using VBScript.
0コメント