|
2002-10-07
| ||
| 13:30 | • Ticket [616480ffff] binary command: addition to man page status still Closed... artifact: d911b989f1 user: nobody | |
|
2002-10-04
| ||
| 17:19 | • Closed ticket [616480ffff]. artifact: 852598729c user: dkf | |
|
2002-09-30
| ||
| 10:56 | • New ticket [616480ffff]. artifact: 3fab4a48bb user: arjenmarkus | |
binary command: addition to man page
Closed / Fixed616480ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2002-09-30 10:56:34
I find the binary command very useful for certain
tasks, yet the description of the command in the man
page is slightly confusing. Therefore I would like to
submit some additional text for the man page that, I
think, will clarify how to use it. (All the information
is there, but it is spread over the various options,
the additional text should summarise some aspects).
[binary format]
After the paragraph starting with "The formatString
consists of ..."
a new paragraph:
Here is a small example to clarify the relation between
the field
specifiers and the arguments:
binary format d3d {1.0 2.0 3.0 4.0} 0.1
The first argument is a list of four numbers, but
because of the count
of 3 for the associated field specifier, only the first
three will
be used. The second argument is associated with the
second field
specifier. The resulting binary string contains the
four
numbers 10, 2.0, 3.0 and 0.1.
[binary scan]
After the paragraph "As with binary format ..."
A similar example as with [binary format] should
explain the relation
between field specifiers and arguments in case of the
binary scan
subcommand:
binary scan $bytes d3d first second
This command (provided the binary string in "bytes" is
long enough)
turns the variable "first" into a list of three numbers
and it assigns a
single value to the variable "second".
Option "a" in the section on "binary scan": explain why
variable var2
is left unmodified (I could not quite figure it out :-)
dkfplain2002-10-04 17:19:31
Logged In: YES user_id=79902 Thanks for this. On the final point, part way through the second paragraph of "BINARY SCAN" we see: .... If there are not enough bytes left after the current cursor position to satisfy the current field specifier, then the corresponding variable is left untouched and binary scan returns immediately with the number of variables that were set. .... This is why var2 is unmodified; it can't get all the chars it wants so it does nothing. To warn you of this, [binary scan] just returns '1' to indicate that only one field was read from.
nobodyplain2002-10-07 13:30:07
Logged In: NO Re var2 unmodified: Your explanation is very clear. I think it could/should be added to the example, as this will clarify the operation (and emphasize the use of the return code)
Log in (anonymous is fine) to add a comment.