Greeting.<br>
<br>
I apologize if this is an old topic but I couldn't find it in the Threads. <br>
<br>
I was trying to use a script (on Windows 95) to sort some binary data. I got some perplexing results so I looked into what was going on and found that Tcl's "binary scan" was reading a hex-83 as hex-26. I wrote a script to generate all 256 1-byte numbers:<br>
proc mkFile {fds} {<br>
set fid1 [open $fds w+]<br>
for {set i 0} {$i<=255} {incr i} {<br>
set ihx [format "%x2" $i]<br>
set outvar [binary format H2 $ihx]<br>
puts -nonewline $fid1 $outvar<br>
}<br>
close $fid1<br>
}<br>
I found that 00 to 0f get written as 02 12 22 32 42 52 62 72 3f 3f a2 b2 c2 d2 e2 f2. Also, 82 to 8c, 91 to 9c, and 9f all get written as 3f. Everything else is right. <br>
<br>
Does anyone know if this is a real problem? Is there something I can do to get around it?
<br>
I apologize if this is an old topic but I couldn't find it in the Threads. <br>
<br>
I was trying to use a script (on Windows 95) to sort some binary data. I got some perplexing results so I looked into what was going on and found that Tcl's "binary scan" was reading a hex-83 as hex-26. I wrote a script to generate all 256 1-byte numbers:<br>
proc mkFile {fds} {<br>
set fid1 [open $fds w+]<br>
for {set i 0} {$i<=255} {incr i} {<br>
set ihx [format "%x2" $i]<br>
set outvar [binary format H2 $ihx]<br>
puts -nonewline $fid1 $outvar<br>
}<br>
close $fid1<br>
}<br>
I found that 00 to 0f get written as 02 12 22 32 42 52 62 72 3f 3f a2 b2 c2 d2 e2 f2. Also, 82 to 8c, 91 to 9c, and 9f all get written as 3f. Everything else is right. <br>
<br>
Does anyone know if this is a real problem? Is there something I can do to get around it?