
Interpreting/parsing a command line type of argument
Hi all-
I've got an interesting question, and I can't seem to find an
answer for it. Maybe I'm looking in the wrong place. Does anyone
have a reference for how to parse a command line efficiently, and
without errors; that is, given a
line in a file one might supply to a VB program:
foobar -fCourier -tlandscape -m10.7 -vScript.txt
how does one parse out the little pieces of information on the
command line? This may be trivial for simple situations, but
what is the best way to go about doing this? If I know I have a
certain number of command line switches, I guess I can just
look for the - sign, look for the next one, and then chop up
the line based on this, and then check which switch I am turning on with
a case statement.
I'm wondering if there is a more global view I should be taking of
the process of parsing this line. I'm looking for either good
examples of how to process something in VB, or reference I can look
at. I'm NOT asking for someone to write code, that's for sure.
I have checked out nice programs like 'a2ps' and the like, which
are for Unix systems, and do processing of command line arguments,
but I thought there might be more information on this. For example;
should I use the '-' as a flag to tell what options are desired,
or is there something better that that.
Just wondering,
A.
--
Andrew P. Anselmo