Re: Parsing options in the same way they are passed to main
From: Ben Pfaff (blp_at_cs.stanford.edu)
Date: 12/13/03
- Next message: Keith Thompson: "Re: gets() rationale"
- Previous message: Paul Hsieh: "Re: Is C99 the final C? (some suggestions)"
- In reply to: Jeff Rodriguez: "Parsing options in the same way they are passed to main"
- Next in thread: Jeff Rodriguez: "Re: Parsing options in the same way they are passed to main"
- Reply: Jeff Rodriguez: "Re: Parsing options in the same way they are passed to main"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 12 Dec 2003 20:13:36 -0800
Jeff Rodriguez <newsgroup1@gurugeek.EXAMPLENOSPAM.com> writes:
> If main is prototyped as:
> int main(int argc, char *argv[]);
>
> You will end up with a bunch of arguments in *argv, and the number in
> argc. Now what I want to do is emulate that same action on a
> string. Say for example I have:
>
> char *command = "./blah --arg1 --arg2 123 -x --arg2=w00t"
>
> How do I acheive the same effect as in main()?
It depends on the operating system, shell, and other things. If
all you want to do is to break apart the string into words at
white space, I suggest you just write code to do it. It's not
too hard.
-- "Given that computing power increases exponentially with time, algorithms with exponential or better O-notations are actually linear with a large constant." --Mike Lee
- Next message: Keith Thompson: "Re: gets() rationale"
- Previous message: Paul Hsieh: "Re: Is C99 the final C? (some suggestions)"
- In reply to: Jeff Rodriguez: "Parsing options in the same way they are passed to main"
- Next in thread: Jeff Rodriguez: "Re: Parsing options in the same way they are passed to main"
- Reply: Jeff Rodriguez: "Re: Parsing options in the same way they are passed to main"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|