binary scan -problem




Hi

It is possible that "binary scan" -command does not work correctly ?

I have following code, which reads the binary file:

while { $ret == 4} {

set line [read $CCSfileID 34]
set ret [binary scan $line "ssA8A22" apo_numero yhtio_numero bussi_tunnus
yhtio_nimi ]
if { $ret == 4 } {
incr count
puts "$count apo=$apo_numero yhtio=$yhtio_numero
bussitunnus=$bussi_tunnus yhtionimi=$yhtio_nimi"

} else {
#puts "ret=$ret"
}
}


Sometimes variable $apo_numero is not correct ! I did not find any rule for
this behavior.

For example, if this variable should be 132, it is 30.
Or 137, it is 48.
Or 401, it is 280.
Or 13, it is 10.

(Range of this variable is: 0 - 500.)
I have compared that with the binary editor and the original binary file.

I have tried by TCL 8.0, 8.3 and 8.4.

Has anyone some hints for this problem ?

---
Esa



.



Relevant Pages