I think '=' is a separator, but that doesn't explain the missing args. If you
throw in
it gets more interesting:
Code:
v:\> batargs a = b c
number of args: 4
I: 0 Value: batargs
I: 1 Value: a
It works better if '=' is immediately preceded by something:
Code:
v:\> batargs a= b c
number of args: 3
I: 0 Value: batargs
I: 1 Value: a
I: 2 Value: b
I: 3 Value: c
I think your loop is terminating at the empty ("") arg just before the '='.
I think it's undesirable behavior (and seem to recall its being discussed in the past with no change).
Vince, thank you, you are obviously correct. But first, I do not remember the "=" sign being used as a separator (separator for
what and
when? Could be my bad memory again...), so if I change the loop terminating condition to
every thing works
almost as I would have expected, except that, as you indicate, the argument that is an equals sign is replaced by a null argument (truthfully. probably based on my C++ experience(s), I didn't know that "null" arguments were even
possible. It makes me wonder how many programs I have written that test for a null argument rather than using the "argc" variable (I tend to write code like that because it is
simpler; even if I used "argc" as a loop counter I would
still have to iterate the "argument" pointer anyway (
two operations instead of one), and not only that but I would
still have to test for a "null" argument anyway or the C++ program would
crash (checking for the "contents" of memory address "0" is
not allowed) and whether I should go systematically through
all of them and
change them!!!) (
Breaking news!!! I just a wrote a quick and dirty C++ program to
test that and it worked just fine! The "=" sign is there just as every
other argument that is
not an "=" sign is there. It would appear that the "=" sign is "eaten" strictly by the argument parser for batch files in TCC. Phew!!!!)