BINARY (API Types) Changed in Version 6.50

www.CAD6.com

C++ Syntax

typedef BYTE BINARY[];

 

Element Description

For a description, see your C++ or Win32/x64 documentation.

 

MKD Syntax

Binary area uses a simple character encoding with run-length compression. The resulting strings are handled like STR data, i.e. the character sequence is delimited by the character " (Ansi 34).

 

Each three bytes are encoded in four characters, using the characters " " (Ansi 32) to "_" (Ansi 95), where the characters 'A' (Ansi 65) to 'Z' (Ansi 90) are case-independent, i.e. they may be replaced by 'a' (Ansi 97) to 'z' (Ansi 122). Due to a better readability, the lower-case characters should be preferred.

 

Together these four characters encode 24 bits, making 3 bytes. The first character encodes the highest 6 bits, the fourth character the lowest 6 bits. The string "adm+" decodes to the decimal value 5655391, resulting in the bytes sequence 56 4b 5f. If the binary string does not include a number of bytes dividable by three, the encoding assumes the missing one or two bytes to be zero, i.e. a single final byte 5f will be encoded identical to 5f 00 00, resulting in the string "7p  " (two spaces at the end).

 

If binary data contains bytes with 0 value at the end, these bytes will usually not be encoded, i.e. the binary string will be shorter than the original data indicates. When reading such data again, missing bytes at the end are to be set to 0. Binary data of all 0 can be encoded as "".

 

Please note that the strings used to encode binary data may contain the characters '"' (Ansi 34) and '\' (Ansi 92). As a result, those strings must be encoded like standard text strings (see MKI_STRxxxA).

 

Run-Length Encoding New in Version 6.50

In addition to this plain binary encoding, sections with numerous 00 and FF bytes can be run-length encoded using the following method: The character '{' (Ansi 123) denotes a sequence of 00 bytes. "{0xxxx" encodes a four-digit hexadecimal number x of zeros, "{1xx" encodes a two-digit hexadecimal number x of zeros, and "{2" to "{f" encodes a one-digit hexadecimal number 2 to 15 of zeros. (Examples: "{003E8" encodes 1000 zero bytes, "{a" encodes 10 zero bytes). The character '}' (Ansi 125) denotes an equally encoded sequence of FF bytes.

 

CAD6interface 2024.2 - Copyright 2024 Malz++Kassner® GmbH