Hi All,
I am new to TCL and going through the binary format command. I am just trying to see how this command works. So I wrote few statements and directed the output to a file. Using hex edit I looked through the content but they are not as expected or may be I am not doing it right. Request you help me with my understanding. thanks .
output
I understand that puts by default adds a newline, so 0A is the delimiter in my output.
my first statement in code i.e., binary format B2 10, as per my understanding, I thought it should give out x/80. But in my output I see an additional X/C2. Not sure why?
my third statement in code i.e., binary format h4 abcd, as per my understanding, I thought I should get x/ba x/cd, but I see again x/C2 x/BA x/C3 x/9C.
So I think I have got a complete wrong understanding from the manual. Any help is greatly appreciated.
Thank you
I am new to TCL and going through the binary format command. I am just trying to see how this command works. So I wrote few statements and directed the output to a file. Using hex edit I looked through the content but they are not as expected or may be I am not doing it right. Request you help me with my understanding. thanks .
Code:
#!/usr/bin/tclsh
set a [binary format B2 10 ]
puts $a
set a [binary format h4 abcd]
puts $a
set b "Hello World"
puts $b
output
Code:
C2 80 0A C2 BA C3 9C 0A 48 65 6C 6C 6F 20 57 6F 72 6C 64 0A
my first statement in code i.e., binary format B2 10, as per my understanding, I thought it should give out x/80. But in my output I see an additional X/C2. Not sure why?
my third statement in code i.e., binary format h4 abcd, as per my understanding, I thought I should get x/ba x/cd, but I see again x/C2 x/BA x/C3 x/9C.
So I think I have got a complete wrong understanding from the manual. Any help is greatly appreciated.
Thank you