Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Working with Binary conversions

 [1/2] from: ptretter::charter::net at: 1-Dec-2001 10:57


I thought I would pass this on if you ever trying to work with binary data and need it in its current state without conversion and need to get at it as a string. Try this: data: form to-binary "trim is really cool" new-data: trim/with data "{}#^/" now you can traverse the series of data much easier. with for example:
>> new-data/1
== #"7"
>> new-data/2
== #"4" Paul Tretter

 [2/2] from: greggirwin:mindspring at: 1-Dec-2001 12:58


Hi Paul, << I thought I would pass this on if you ever trying to work with binary data and need it in its current state without conversion and need to get at it as a string. Try this: >> A semi-related question. Why can't you poke binary values? Change works, but poke only seems to let you use char! values (haven't tried exhaustive data type checking yet).
>> data: to-binary "Convert me ton binary"
== #{436F6E76657274206D6520746F6E2062696E617279}
>> change at data 2 #{FF}
== #{6E76657274206D6520746F6E2062696E617279}
>> data
== #{43FF6E76657274206D6520746F6E2062696E617279}
>> poke data 3 #{FF}
** Script Error: Invalid argument: #{FF} ** Near: poke data 3 #{FF}
>> poke data 3 #"ÿ"
== #{43FFFF76657274206D6520746F6E2062696E617279} Or am I making some basic mistake here? --Gregg