Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems interpreting certain binary data

Status
Not open for further replies.

Bong

Programmer
Dec 22, 1999
2,063
US
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 &quot;binary scan&quot; 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&lt;=255} {incr i} {<br>
set ihx [format &quot;%x2&quot; $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?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top