473,503 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Any class to help me process the command line options?

Hi All,

A lot of program has to read some options. I'm wondering whether there
is any standard way to do that. And is there any existing packages or
classes for this purpose?

Somebody mentioned
http://www.gnu.org/software/libc/man...gram-Arguments
to me. Is there anything better than that?

Thanks!

Best wishes,
Peng

Jul 23 '05 #1
8 1252
www.boost.org

They have Boost.Program_options. Not sure how it works (never used it
myself) but sounds like what you are looking for.
http://www.boost.org/doc/html/program_options.html
<Pe*******@gmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
Hi All,

A lot of program has to read some options. I'm wondering whether there
is any standard way to do that. And is there any existing packages or
classes for this purpose?

Somebody mentioned
http://www.gnu.org/software/libc/man...gram-Arguments
to me. Is there anything better than that?

Thanks!

Best wishes,
Peng

Jul 23 '05 #2
Bob Smith wrote:
www.boost.org

They have Boost.Program_options. Not sure how it works (never used it myself) but sounds like what you are looking for.
http://www.boost.org/doc/html/program_options.html


Why do you recommend those strange operator() overloadings? Can you
elaborate?

Thank you!
A.

Jul 23 '05 #3
Pe*******@gmail.com wrote:
Hi All,

A lot of program has to read some options. I'm wondering whether there
is any standard way to do that. And is there any existing packages or
classes for this purpose?

Somebody mentioned
http://www.gnu.org/software/libc/man...gram-Arguments
to me. Is there anything better than that?

Thanks!

Best wishes,
Peng


Many implementations provide 'getopt()';
GCC usually does.
Try 'man -S 3 getopt' to see if yours does.

Regards,
Larry

--
Anti-spam address, change each 'X' to '.' to reply directly.
Jul 23 '05 #4
Pe*******@gmail.com wrote:
Hi All,

A lot of program has to read some options. I'm wondering whether
there is any standard way to do that. And is there any existing
packages or classes for this purpose?

Somebody mentioned
http://www.gnu.org/software/libc/man...gram-Arguments to me. Is there anything better than that?


If you want to be standard, using argc and argv is your only option.

Kristo

Jul 23 '05 #5

"Abecedarian" <ab*********@spambob.com> skrev i en meddelelse
news:11**********************@g14g2000cwa.googlegr oups.com...
Bob Smith wrote:
www.boost.org

They have Boost.Program_options. Not sure how it works (never used it

myself) but sounds like what you are looking for.
http://www.boost.org/doc/html/program_options.html


Why do you recommend those strange operator() overloadings? Can you
elaborate?

Thank you!
A.

It is foremost a question of whether you are comfortable with operator
overloading, i suppose. I only skimmed the documentation, but to me it looks
like a very intuitive interface. If you have recommendations for
improvement, I'm sure the boosters would like to know about them.

/Peter
Jul 23 '05 #6
Peter Koch Larsen wrote:
"Abecedarian" <ab*********@spambob.com> skrev i en meddelelse
news:11**********************@g14g2000cwa.googlegr oups.com...
Bob Smith wrote:
www.boost.org

They have Boost.Program_options. Not sure how it works (never used
it
I only skimmed the documentation, but to me it looks
like a very intuitive interface.


Wow, I really admire people proficient in Lisp.

Jul 23 '05 #7

Kristo wrote:
Pe*******@gmail.com wrote:
Hi All,

A lot of program has to read some options. I'm wondering whether
there is any standard way to do that. And is there any existing
packages or classes for this purpose?

Somebody mentioned

http://www.gnu.org/software/libc/man...gram-Arguments
to me. Is there anything better than that?


If you want to be standard, using argc and argv is your only option.

Or find source code to do it, one of the many implementations of
getopts() or similar things.

Brian

Jul 23 '05 #8
Abecedarian wrote:
Peter Koch Larsen wrote:
"Abecedarian" <ab*********@spambob.com> skrev i en meddelelse
news:11**********************@g14g2000cwa.googlegr oups.com...
> Bob Smith wrote:
>> www.boost.org
>>
>> They have Boost.Program_options. Not sure how it works (never used

it
I only skimmed the documentation, but to me it looks
like a very intuitive interface.


Wow, I really admire people proficient in Lisp.


I really don't see how you get to this association.

Besides this sounds a lot like sarcasm, and doesn't help the OP.

Program_options is quite a good package for command line parsing.
(I've tried quite a few) For simple needs you need 10 - 15 Lines of code,
and you can add more advanced Parsing options easily (Config files, grouping
of Options, ...)
Besides it part of Boost, this means it works on most relevant Platfoms, and
is very high quality.

@Abecedarian: It seems that you don't like most of C++ features that go a
bit above novice level, thats fine, but please don't diss anyone and
anything that uses these features.

And another point for Program_options just for you: if you don't like the
operator chaining, you can also use the .add(...) functions, either in a
chaind way like "clp.add("option1,o").add("option2,p");" or free standing
"clp.add("option1,o"); clp.add("option2,p");"

regards

Fabio
Jul 23 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2766
by: Edvard Majakari | last post by:
Hi, I was wondering what would be the most elegant way for creating a Python class wrapper for a command line utility, which takes three types of arguments: 1. options with values (--foo=bar)...
6
2303
by: Peter Kleiweg | last post by:
I'm still new to Python. All my experience with OO programming is in a distant past with C++. Now I have written my first class in Python. The class behaves exactly as I want, but I would like to...
5
2031
by: Nick Gilbert | last post by:
Hi, I'm having problems using Flash Remoting with Web Services for ASP.NET and I've narrowed the problem down to csc.exe when it tries to compile the stub class. Flash Remoting...
1
4317
by: treelife | last post by:
I'm getting and internal server error when | run the following mod_python script. I am actually trying to run Django. Script: from mod_python import apache def handler(req):...
15
2551
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
2
4169
by: =?Utf-8?B?SnJ4dHVzZXIx?= | last post by:
I just started using Windows Live OneCare, I had been using Norton, but was unable to fix the problems I was having. I have yet been unsuccessful with OneCare as well. I keep getting the same...
0
3154
by: SOI_0152 | last post by:
Hi all! Happy New Year 2008. Il hope it will bring you love and happyness I'm new on this forum. I wrote a stored procedure on mainframe using DB2 7.1.1 and IBM language c. Everything works...
7
2107
by: Michele Simionato | last post by:
I have noticed that the python-mode for Emacs that comes with the latest Ubuntu is missing the class browser. Moreover if works differently from the python-mode I was used to (for instance CTRL-c-c...
0
7202
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
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7462
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...
1
5014
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...
0
4673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.