471,579 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,579 software developers and data experts.

Standard command line argument parser.

Hello all,

I was wondering if there is a C/C++ command line parser that works for
linux AND windows. .

Anyways, the ideal parser im looking for should be able to support
multiple
arguments per option.

Example: $myProg --option1 arg arg arg --option2 arg --option3 arg
arg arg.

I have looked at GetOpt_long with no success. I am using visual studio
2003 and Getopt is not included. I am also unable to locate a place to
download the source. I know they are already in Linux distributions but
I need them to try them in windows as well.

Any help would be greatly appreciated.

Thanks

Aug 2 '06 #1
6 4010
31******@gmail.com wrote:
I was wondering if there is a C/C++ command line parser that works for
linux AND windows. .
You should probably ask in a Linux newsgroup or a Windows newsgroup. See
the FAQ for a list of recommended forums.
[..]
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 2 '06 #2
31337...@gmail.com wrote:
I was wondering if there is a C/C++ command line parser that works for
linux AND windows. .

Anyways, the ideal parser im looking for should be able to support
multiple
arguments per option.

Example: $myProg --option1 arg arg arg --option2 arg --option3 arg
arg arg.

I have looked at GetOpt_long with no success. I am using visual studio
2003 and Getopt is not included. I am also unable to locate a place to
download the source. I know they are already in Linux distributions but
I need them to try them in windows as well.

Any help would be greatly appreciated.
Try:

http://boost.org/doc/html/program_options.html

or the links found here:

http://www.parashift.com/c++-faq-lit....html#faq-37.9

Cheers! --M

Aug 2 '06 #3
On 2 Aug 2006 09:39:03 -0700, 31******@gmail.com wrote:
>I was wondering if there is a C/C++ command line parser that works for
linux AND windows. .
http://www.codeproject.com/useritems/SimpleOpt.asp
Aug 2 '06 #4

Roland Pibinger wrote:
On 2 Aug 2006 09:39:03 -0700, 31******@gmail.com wrote:
I was wondering if there is a C/C++ command line parser that works for
linux AND windows. .

http://www.codeproject.com/useritems/SimpleOpt.asp

That does not appear to support multiple arguments per option. I have
already looked into it.

Example: $myApp -option1 arg arg arg -option2 arg -option3 arg arg
arg

And be able to identify the args with the options that precede them.

So option1 has 3 arguments; option2 has 1 argument and option3 has 3
arguments.

Aug 2 '06 #5
31337one wrote:
>http://www.codeproject.com/useritems/SimpleOpt.asp


That does not appear to support multiple arguments per option. I have
already looked into it.
For a "elite one", it seems a strange question to ask.

Especially considering I recently implemented a typesafe command-line
parser that automatically dumped the options into same-named global
variables with TDD in like 100 lines of code. It's not exactly rocket
science.

I can't share the code as it was written in the employ of a company.

Aug 3 '06 #6

Tom Plunket wrote:
31337one wrote:
http://www.codeproject.com/useritems/SimpleOpt.asp

That does not appear to support multiple arguments per option. I have
already looked into it.

For a "elite one", it seems a strange question to ask.

Especially considering I recently implemented a typesafe command-line
parser that automatically dumped the options into same-named global
variables with TDD in like 100 lines of code. It's not exactly rocket
science.

I can't share the code as it was written in the employ of a company.

I have written a command line parser for my project as well. Other
engineers that I am working with want to a use some standard command
line parser. They suggest getopt but its not even in Visual Studio.
They point me to a windows port of it, well it needs to be on both
windows andl linux. Well there isnt a STANDARD one for both linux and
windows that has the options I need.

If it was my choice, I'd use my parser, it works fine, it supports
multiple arguments per option and its already done and implemented.
Finding one to replace it is wasting more time than it is worth.

Yeah, it does feel dumb asking this question. I have scoured the
internet for something small and compatible and had no luck.

Aug 3 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Boogie El Aceitoso | last post: by
7 posts views Thread by mackmelo | last post: by
16 posts views Thread by John Salerno | last post: by
13 posts views Thread by Chris Carlen | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by Vinnie | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.