Skip to content

_binary

bergsma edited this page Sep 26, 2014 · 5 revisions

#binary

###Create or convert a variable or value into a binary format

Syntax

result = binary value ;
binary variable [= value] ; 

Arguments

  1. list value

A value of any type.

Return Value

binary result
  • 0x00 - 0xff : A binary value is 1 byte. It is displayed as a 2 character hex number. All strings convert to a value of 0x01 except when the string begins with a "%", then the binary value is 0x00. When converting to and from binary, char and uchar vector values are preserved.

The STATUS variable is set to $ACKNOWLEDGE

When the argument is an array variable, all the elements in the array are converted, and the result will be a vector array binary result

  • 0x00 - 0xff : A binary value is 1 byte. It is displayed as a 2 character hex number. All strings convert to a value of 0x01 except when the string begins with a "%", then the binary value is 0x00. When converting to and from binary, char and uchar vector values are preserved.

The STATUS variable is set to $ACKNOWLEDGE

When the argument is an array variable, all the elements in the array are converted, and the result will be a vector array

Exceptions

  • %ARGUMENT: Invalid arguments. Usage: binary variable [= value] ;

  • %IDENTIFIER: 'variable' argument is not a valid identifier, literal, or reference

Description

None

Examples

str a = "abcdefg" ;
char a ;
put a ;

binary a ;
put a ;

put binary "%FAILURE" ;

put binary "$SUCCESS" ;

S1F14 = { binary commack = 0,
          list id = {
            char name[11] = "HyperScript",
            char rev[6] = version()
          }
} ;
describe S1F14 ;

Related Links

hex

Clone this wiki locally