@BINTOB85 — Encodes the contents of a binary buffer as a base-85 string.
Syntax:
%@BINTOB85[
handle,
start,
length]
handle | the handle to a binary buffer, as returned by @BALLOC |
start | the offset in bytes at which to begin encoding; defaults to 0 |
length | the number of bytes to encode; defaults to 128 or the remainder of the buffer |
This function encodes binary data (from a binary buffer) as a string which
can be easily handled by TCC. You can store this string in an environment
variable, write it to an .INI file, and so on. To restore the original binary
data, use the @B85TOBIN
function.
Four bytes of data are encoded into five characters; encoding a 1024-byte buffer will result in a 1,281-character-long string (counting the terminal null). Keep in mind that encoding long series of bytes will produce even longer strings! If you don’t specify a length, the default is 128 bytes or to the end of the buffer.
This implementation of base-85 differs from others. The set of characters used to encode binary data has been chosen to avoid syntactically troublesome signs like quotes, percent signs, ampersands, carets, and so on. All characters are ASCII, so the string should not be mangled by code page translations.
See also: the B85TOBIN
function.