Module to process application parameters
Hello!
Has anyone a module to procees application parameters?
For example, my application run with this parameters:
myapp -h127.0.0.1 -Uusername mydb
I need to recognize parameters and values. I can write my own module, but I think sombody already done it.
Re: Module to process application parameters
1. man getopt (and look at getopt_long)
2. GetOpt class
Re: Module to process application parameters
1 is all good and well if you're writing specifically for unix.
2 is Ok if you're writing a GUI application or an application that requires an event loop.
Neither is acceptable if you're writing a simple server application that wants to parse the command line on startup and doesn't want the huge footprint of Qt's event loop or GUI.
Has somebody written something like this yet?
Re: Module to process application parameters
I assure you the getopt class from Froglogic doesn't require an event loop... Moreover you can substitute Qt calls with STL calls and you'll strip the Qt dependency.
For Windows you can use this:
http://www.codeproject.com/cpp/xgetopt.asp
Re: Module to process application parameters