Tech Tip: Using Bitwise Operators on BLOBs
PRODUCT: 4D | VERSION: 11.5 | PLATFORM: Mac & Win
Published On: March 15, 2010
Although bitwise operators are generally used on Longinteger and Integer values they can be used in 4D on BLOB's as well. You can do this by treating the BLOB as an array of bytes. This gives you bit-level access to BLOB's.
For example the following code can modify a 1 Byte BLOB's 4th bit using the bit set operator:
C_BLOB($myblob) SET BLOB SIZE($myblob;1) `$myblob{0} = 0 $myblob{0}:=1 `$myblob{0} = 1 $myblob{0}:=$myblob{0} ?+ 4 `$myblob{0} = 17 |