StuffHex
StuffHex Convert a string of hex digits to binary data Ptr destPtr ; generic pointer; address of any data type Str255 hexString ; Pascal-style string of hex digits StuffHex reads a pascal-style string of hexadecimal digits, converts them to binary data and stores the result into any data type.
destPtr is the address of any type of data object; typically the address of a
pointed to by destPtr will be overwritten with binary data.
hexString is the address of a Pascal-style string (a length-prefixed array of
characters). Following the length byte, all characters must be in the
range '0' to '9' and 'A' to 'F'.
Notes: This call performs no range checking, so make sure that the buffer at
destPtr is large enough to receive all the binary data defined in hexString .
The destination buffer may need to be as large as 127 bytes.
This function can be useful during program development, but it is rarely
needed in a finished program - your compiler is capable of converting hex
digits into binary data. For instance, the sequence:
StuffHex( &myPat, "\p0103070F1F3F7FFF" ) can be eliminated by defining the pattern at compile time; e.g.,
Pattern myPat = { 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF }; Furthermore, most objects that you might wish to pack with binary data
should probably be predefined and available as a program resource.