Combine values into a raw vector according to the values in template.
Usage
pack(template, ...)
Arguments
template
A string, see 'Details'
...
Values/objects to be packed into a raw vector
Value
A raw vector following the elements in template.
Details
Currently supported template values are:
'a' - A null padded string
'A' - A space padded string
'b' - An ascending bit order binary vector, (must be a multiple of 8 long)
'B' - An descending bit order binary vector, (must be a multiple of 8 long)
'C' - An unsigned char (octet) value
'v' - An unsigned short (16-bit) in "VAX" (little-endian) order
'V' - An unsigned long (32-bit) in "VAX" (little-endian) order
'x' - A null byte
Both 'a' and 'A' may be followed by a repeat value. A repeat value of '*'
will cause the remainder of the bytes in values to be placed in
the last element.
'/' allows packing and unpacking of a sequence of values where the packed
structure contains a packed item count followed by the packed items themselves.
If template requires more arguments to pack than actually given,
pack pads with null bytes. If template requires fewer
arguments to pack than actually given, extra arguments are ignored.