On 8/12/2012 4:08 PM,
penci...@yahoo.com wrote:
> tcl newbie and i'm baffled. i have a string of hex characters and i want to convert them to the ascii.
>
> input: 61 62 63
> output: abc
>
> i must have missed something on page 1 of the manual because no searches seem to be able to tell me how to do this. the closest i have come is that 'puts' does some auto conversion, but i want to use the new value, not print it.
>
> set a "0x61 0x62 0x63"
> puts "$a = [binary format c* $a]"
You were looking right at your answer.
> 1 % set a "0x61 0x62 0x63"
0x61 0x62 0x63
> 2 % set b [binary format c* $a]
abc
[binary format] did all the work.
HTH,
Gerry