Praveen wrote:
Hi,
Any one ever used getopt function more than once. Here is my example.
I have to run a process as
myProcess -x -y -c "-a -f myFile -o myOutput -d debugFile"
First I have to check for -c option and use the value of this -x
argument for next get opt.
Any one has an experience in the same. The reply will be highly
appreciated.
Regards
Praveen Kumar M
I don't really understand what you mean. But in the manner you wrote it
and assuming that -c is specified with an argument ("c:" in the option
string) the string "-a -f myFile -o myOutput -d debugFile" is parsed as
a single argument to -c. Otherwise will be parsed as a positional argument.
I don't think you can parse it using getopt() since it is a single
string not an array of pointers to the single word.
Ciao
Giovanni
--
A computer is like an air conditioner,
it stops working when you open Windows.
Registered Linux user #337974 <http://counter.li.org/>