BinaryPeek

Returns the value of a byte from a binary buffer.

 

Syntax for BinaryPeek Functions:

BinaryPeek( handle, offset )  Peeks an 8 bit value.

BinaryPeek2( handle, offset )  Peeks a 16-bit value.

BinaryPeek4( handle, offset )  Peeks a 32-bit value.

BinaryPeek8( handle, offset )  Peeks a 64-bit value as a huge number.

BinaryPeekFlt( handle, offset )  Peeks a 64 bit floating point number.

Parameters:

(i) handle: handle of buffer.

(i) offset: offset zero-based offset in the buffer to obtain byte from.

Returns:

(i)  new byte value.

 

Use these functions to return the value of a number in the binary buffer. The BinaryPeek's extract 1, 2, 4, or 8 bytes (respectively) beginning at "offset". BinaryPeekFlt treats the 8 bytes it extracts as a 64 bit floating point number.

 

Example:


binbuf=BinaryAlloc(10)
BinaryPoke( binbuf, 5, -14 ) ;Pokes a new value into the buffer.
a=BinaryPeek( binbuf, 5 ) ;Finds the value of a byte.
Message("Hmmm", "Returned value is %a%" )
; Value will be 242 which is (256 - 14). 242 and -14 map
; to the same 8bit number.
See Also:

Binary Operations, BinaryCopy, BinaryIncr, BinaryPeekStr, BinaryPoke, BinaryPokeStr