errors reading (with "scan") binary numbers
Closed / Invalid224558ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-12-05 15:50:36
I read 1 byte from a binary file:
set readst [read $fid1 1]
Then I try to convert it:
binary scan $readst H2 var1
I use a file that has 255 1-byte values increasing (00, 01,...,ff). The results are not reliable. OO through 0c read fine. Then I get "0a" instead of "0d". Then after x19, everything is wrong.
welchplain2000-12-06 14:32:50
Make sure you fconfigure $fid -translation binary so that, for example, carriage returns (0xd) are not converted to newlines (0xa)
dkfplain2000-12-06 16:47:12
This does have all the hallmarks of an omitted -translation option, doesn't it? I've just checked against the latest CVS version, and that correctly sets up the -encoding and -eofchar options when -translation binary is set, so I'll close this bug as invalid (Tcl's behaving right, the script is just missing a (fully documented) command.)
Log in (anonymous is fine) to add a comment.