ccBin$

Syntax

STRING = ccBin$(Decimal:Pointer,Length:Uint,OPT Trim=TRUE:Uint),String

Description

Convert "Decimal" To Binary as String.

Parameters

Decimal - A variable up to 8 bytes long to convert.
Length - The "Lenght" of bytes corresponding to the variable (1,2,4,8) -max. "Length" = 8
Trim - (Boolean)
TRUE = No alignment [Zeros Trimed from the Left]
FALSE = With Zeros aligned.

Return value

Returns the binary String == "Decimal".
Returns an empty string if 0 => "Length" > 8!

Remarks

"Length" can be used to cut the high byte(s) off a multi-bytes variable.
Sample:FFFFFFFE00000001 =
1111111111111111111111111111111000000000000000000000000000000001 by "Length" = 8
********11111111111111111111111000000000000000000000000000000001 by "Length" = 7

If you wanna convert longer than 8 bytes like 'AnyType' or a memoryblock.
You have to modify the 8 bytes restriction in the source code.
But you have to make sure the returning string have enough space to hold the binary digits!

Attention!!
Using greater "Length" as the LEN(Variable) will fill up the extra bytes with random bits in!!

Example usage

DEF MyVar32:UInt
MyVar32 = 0x0BF1F2F3
PRINT "Uint32:",ccBin$(MyVar32,4)

See
ccBin$_Demo.eba