Bset » History » Revision 10

Revision 9 (Per Amundsen, 07/27/2022 02:23 AM) → Revision 10/11 (Per Amundsen, 09/06/2022 06:58 PM)

_Added in 1.9.0_ 

 */bset [-tacz] <&binvar> <N> <asciivalue> [asciivalue ... asciivalue]* 

 Sets the <N>th byte in binary variable &binvar to the specified ascii value. 

 _If N = -1, the data is added to the end of the variable._ 

 If the &binvar docent exists it is created. 
 If <N> is larger than the size of &binvar it will be zero filled up to <N> bytes. 
 If you specify multiple "ASCII": values, they are copied to successive positions after byte position N. 


 -t - Treat values a plain text. 
 -a - Disables UTF-8 encoding of characters in the range 0-255, as long as the text contains no characters > 255. 
 -c - Chops the &binvar at the end of the copied bytes. 
 -z - Creates new or truncates existing &binvar at zero length. TODO 


 <&binvar> - The &binvar to modify. 
 <N> - The byte to modify. (one based) 
 <asciivalue> - The "ASCII": value to insert. 


 alias example { 
   ; Create a binary variable set it to "This is fun!" 
   bset -t &Example 1 This is fun! 
   ; Print out the content of the variable 
   echo -a $bvar(&Example, 1-).text