WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Binary Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

BinaryPeek versus BinaryPeekStr Functions

Keywords: 	 BinaryPeek BinaryPeekStr

Question:

Hi! I am trying to use the binary functions to read an ASCII text file. The data in the file is made up of both text strings and numbers.

I need to be able to read the numbers so that I can do some simple math with them. So, it seems that there would be two ways to do that: 1) read the numbers as a string, then convert the string to a numeric, or 2) read the numbers using the binarypeek(), binarypeek2(), etc. functions.

  1. 1st Question: Is there a function that would convert a string into a numeric?

  2. 2nd Question: I don't understand the output of the binarypeek functions...they don't seem to return the decimal number that is being read at the offset. Can someone explain what the output of these functions (binarypeek, binarypeek2, etc.) is supposed to be?

Answer:

If it is an ASCII file then it is ALL strings (even if it looks like numbers), and you should use the BinaryPeekStr function to grab data.

Generally no conversion for a real number from string to number is required, WinBatch will do that automagically for you.

BinaryPeek, 2, 4, and Flt are for binary files where the number is stored in binary (rather than ASCII) format.


Article ID:   W12726
Filename:   BinaryPeek versus BinaryPeekStr.txt
File Created: 1999:04:15:16:49:12
Last Updated: 1999:04:15:16:49:12