Description Usage Arguments Details Value Note Author(s) References See Also Examples
Break a raw vector into chunks according to the values in template
.
1 |
template |
A string, see 'Details' |
... |
Raw vector(s) to be unpacked |
Currently supported template
values are:
'a' - A null padded string (as of R-2.8.0, strings cannot contain embedded nulls)
'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
'f' - A single-precision float
'd' - A double-precision float
'x' - A null byte
'H' - A raw byte
Values 'a', 'A', and 'H' 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 there are more template
values or if the repeat count of a field
or a group is larger than what the remainder ... allows, unpack
returns NULL
. If ... is longer than what is described by
template
, the rest is ignored.
A list with an element for each value in template
.
When unpacking, 'A' strips trailing whitespace and nulls and 'a' returns data verbatim (but with embedded nulls removed, since strings cannot contain embedded nulls as of R-2.8.0).
Josh Ulrich
http://perldoc.perl.org/functions/unpack.html
1 2 3 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.