Conversion of hex pairs to chars...best way?
T. R. Ponn
alptex2 at orwell.net
Thu May 22 18:03:01 EDT 2003
Richard...thanks, but I failed to mention that these files are typically
binary (which of course, isn't a problem) or come to my app in the form
of a Motorola S-Record or Intel Hex. My app opens these files, does the
necessary checking..prepares them as packets...then sends them via write
to socket to a remote embedded system we've designed. So, I don't
believe the base64Encode/Decode will do the job for me.
BTW...we're really excited about this new product and my app has been in
beta for a few months now...I just can't stand *not* tinkering. Much
praise to Rev and this list...without both, we wouldn't have been able
to do this! I will be posting our app to the Rev site a soon as it's
released.
Best Regards,
Tim Ponn
Richard Gaskin wrote:
>T. R. Ponn wrote:
>
>
>
>>Here's something I've done MANY times with HC over the years and I'm
>>hoping there's a less time consuming way to accomplish it with Rev:
>>
>>I have the need to convert mass quantities of lines of data in this form:
>>
>>"5265766F6C7574696F6E", as an example. They are pairs (base16) of:
>>
>>"82_101_118_111_108_117_116_105_111_110", in base10 (underscores added
>>here for clarification). And they become:
>>
>>"Revolution" in ASCII chars.
>>
>>Now what I've *been* doing in Rev is something akin to:
>>
>>put empty into whatEverOut
>>put "5265766F6C7574696F6E" into whatEver
>>repeat with i=1 to the number of chars of whatEver
>>put numToChar(baseConvert((char ((i*2)-1) to (i*2) of
>>whatEver),16,10)) after whatEverOut
>>end repeat
>>put whatEverOut
>>
>>Is this a good way to do this, or is there something that can be done
>>with a "repeat for each" form? This ( similar) is used soooooo much in
>>my app that it's bound to make a significant difference. Oh...and
>>occasionally I have to do this routine "in reverse".
>>
>>
>
>Would using base64encode and base64decode functions provide you with a
>similarly useful result?
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.runrev.com/pipermail/use-livecode/attachments/20030522/3c26d1da/attachment.html>
More information about the use-livecode
mailing list