473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 4141
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Boogie El Aceitoso | last post by:
Hi, I need a command line parser that understands filename swith spaces. Since I'm absolutelly sure I'm not the first developer to need a command line parser, I was wondering is there's a...
3
by: Bill Cohagan | last post by:
I'm writing a console app (in C#) and I want to be able to redirect the standard input/output streams when it's run at a command prompt. IOW I want to support the "<" and ">" redirection syntax....
5
by: jlea | last post by:
I'm trying to pass a filename, obtained with using the fileName property from the OpenFileDialog, as a application parameter in Process.StartInfo.Arguments and run a MFC/C++ application using the...
7
by: mackmelo | last post by:
Hi, I'm trying to create a program that reads these two characters (& and ^) as arguments to a funcion. However since they are part of the operational system characters with special funcions...
17
by: News | last post by:
Hi everyone, My goal is to pull command switches/options from a file and then assign the values to select variables which would eventually be included in a class object. The data file looks...
8
by: Andrew Robert | last post by:
Hi Everyone. I tried the following to get input into optionparser from either a file or command line. The code below detects the passed file argument and prints the file contents but the...
16
by: John Salerno | last post by:
Here's my new project: I want to write a little script that I can type at the terminal like this: $ scriptname package1 where scriptname is my module name and any subsequent arguments are the...
9
by: PengYu.UT | last post by:
Hi, I feel argparse has some useful things that optparse doesn't have. But I can't find it argparse in python library reference. I'm wondering when it will be available in the python standard...
13
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.