BIN2STR$(type, value [,BIG])

Returns a string containing the binary representation of value.

typedescription
INT64signed 64-bit integer converted to an 8 byte string
UINT64unsigned 64-bit integer converted to an 8 byte string
INT32signed 32-bit integer converted to a 4 byte string
UINT32unsigned 32-bit integer converted to a 4 byte string
INT16signed 16-bit integer converted to a 2 byte string
UINT16unsigned 16-bit integer converted to a 2 byte string
INT8signed 8-bit integer converted to a 1 byte string
UINT8unsigned 8-bit integer converted to a 1 byte string
SINGLEsingle precision floating point number converted to a 4 byte string
DOUBLEdouble precision floating point number converted to a 8 byte string

By default the string contains the number in little-endian format (i.e. the least significant byte is the first one in the string). Setting the third parameter to BIG will return the string in big-endian format (i.e. the most significant byte is the first one in the string). In the case of the integer conversions, an error will be generated if the value cannot fit into the type (eg, an attempt to store the value 400 in a INT8).

This function makes it easy to prepare data for efficient binary file I/O or for preparing numbers for output to sensors and saving to flash memory.

See also the function STR2BIN