Re: commandline arguments using Glib::OptionEntry
- From: Dancefire <dancefire gmail com>
- To: Paul Jorgensen <pauljorgensen5 gmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: commandline arguments using Glib::OptionEntry
- Date: Tue, 27 Jan 2009 12:19:37 +1100
You may try boost::program_options, it is a template library in boost, which handles the program options. you can check the following links about the tutorial. http://www.boost.org/doc/libs/1_37_0/doc/html/program_options.html
On Mon, Jan 26, 2009 at 2:50 PM, Paul Jorgensen <pauljorgensen5 gmail com>
Yes, your right I think, I will code a class as I have in Visual Studio MFC that will do everything for the commandline arguments. I went through the same thing with Windows, I looked at different options that were available and ended up having to do it all myself. I know some people are using the Glib::OptionEntry code to detect their args, others use getopt, and others use completely custom code. I like your vector idea, I plan to try using that!
On Sat, Jan 24, 2009 at 6:43 AM, Bernd Robertz <bernd robertz cssweb de>
you can use the options as in any other C++ application.
You can derefence it through the "char**" parameter of the main
# progname -n para1,para2,para3,para4
You would check in your application for the "-n" parameter wich would be
found in this exampla in "char" and then you can reach the "paraX"
The above example would store the parameter as:
"progname" = argc = 1 = argv
"-n" = argc = 2 = argv
"para1,para2..." = argc = 2 = argv
So argv IS already a char-string.
For example you could cast it to a Glib::ustring and search/replace by
the "," and store them in a vector or something Gtkmm equivalent
(perhaps as an own class or function). After that, you can pass it as a
parameter to your class wich builds the OptionEntry and work with your
If I have to deal with cli parameter, I often do it like this way
depends on what I need. It works for me.
Am Donnerstag, den 22.01.2009, 23:58 -0400 schrieb Paul Jorgensen:
> hello all!
> I have looked through the gtkmm documention, etc and I can browse
> through more source and documentation, but I thought I would give this
> mailing list a shot for an answer first!
> How would one add a variable commandline argument such as the
> following in gtkmm?
> ie once the -n is specified, then the user could add up to 1-10 items
> for example that are comma delimited.
> I have added the -n arg using the OptionEntry etc, but I am not sure
> how to go about getting the parameters on the -n argument passed back/
> parsed. I want the "one,two,three,..." either passed back as a string,
> or tokenized into individual tokens..and I would want to omit the ":"
> from the results..
> If anyone knows this off the top of their head I would really
> appreciate it.
( remove the brackets to send me an
> email )
> gtkmm-list mailing list
> gtkmm-list gnome org
gtkmm-list mailing list
gtkmm-list gnome org
Microsoft Certified Technology Specialist
] [Thread Prev