IB Statements/binary

From CometWiki

Jump to: navigation, search

BINARY function

Syntax: BINARY(string-argument)

Discussion: The BINARY function returns 8 bytes for each character in the string-argument. The retured bytes represent the 8 bits in each character of the string-argument. If the bit is "on", the corresponding byte will be "1". If the bit is "off", the corresponding byte will be "0".

History: This function was added in Comet 504.

Example 1: IF SUB(BINARY(FLAGBYTE$),1,1) = "1" GO EightyBitOn

Example 2:

LENGTH  5 & LOCAL ITEM1$
LENGTH 40 & LOCAL ITEM2$
.
.
.
INPUT (0) ITEM1$

ITEM2$ = BINARY(ITEM2$)

In this example, a 5-byte string (ITEM$) is converted to it's binary equivalent, which results in a 40-byte string (ITEM2$).

Personal tools