diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2002-10-09 14:07:35 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2002-10-09 14:07:35 (GMT) |
commit | 16284e7d81c8d903edecbbaa014ae84589140150 (patch) | |
tree | 54f852b37ddbdc934dd42157d67306eafefd7a68 /doc | |
parent | 032a90676e216e13e9769d2882ac43bb1f30f705 (diff) | |
download | tcl-16284e7d81c8d903edecbbaa014ae84589140150.zip tcl-16284e7d81c8d903edecbbaa014ae84589140150.tar.gz tcl-16284e7d81c8d903edecbbaa014ae84589140150.tar.bz2 |
More clarification of [binary scan]'s behaviour.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/binary.n | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/doc/binary.n b/doc/binary.n index 7064b99..3be7d59 100644 --- a/doc/binary.n +++ b/doc/binary.n @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: binary.n,v 1.10 2002/10/04 10:23:33 dkf Exp $ +'\" RCS: @(#) $Id: binary.n,v 1.11 2002/10/09 14:07:43 dkf Exp $ '\" .so man.macros .TH binary n 8.0 Tcl "Tcl Built-In Commands" @@ -337,16 +337,27 @@ A similar example as with \fBbinary format\fR should explain the relation between field specifiers and arguments in case of the binary scan subcommand: .CS -\fBbinary scan $bytes i3i first second\fR +\fBbinary scan $bytes s3s first second\fR .CE .PP This command (provided the binary string in the variable \fIbytes\fR is long enough) assigns a list of three integers to the variable \fIfirst\fR and assigns a single value to the variable \fIsecond\fR. -If \fIbytes\fR contains fewer than 16 bytes (i.e. four 4-byte +If \fIbytes\fR contains fewer than 8 bytes (i.e. four 2-byte integers), no assignment to \fIsecond\fR will be made, and if -\fIbytes\fR contains fewer than 12 bytes (i.e. three 4-byte integers), -no assignment to \fIfirst\fR will be made. +\fIbytes\fR contains fewer than 6 bytes (i.e. three 2-byte integers), +no assignment to \fIfirst\fR will be made. Hence: +.CS +\fBputs [binary scan abcdefg s3s first second]\fR +\fBputs $first\fR +\fBputs $second\fR +.CE +will print (assuming neither variable is set previously): +.CS +\fB1\fR +\fB25185 25699 26213\fR +\fIcan't read "second": no such variable\fR +.CE .PP It is \fBimportant\fR to note that the \fBc\fR, \fBs\fR, and \fBS\fR (and \fBi\fR and \fBI\fR on 64bit systems) will be scanned into |