|
Project Information
Members
Featured
Downloads
Links
|
This is yet another C++ version of the getopt function, that is, for parsing command line options and environment variables. However, unlike other versions, the design goals of this one are:
That is, you just construct a GetOpt_pp object with argc and argv, and then extract the options with the >> operator as an istream :) Example: We want to receive two options, one for an int (say, named -i and --test1), and another for a float (named -f and without long option). Results in test1 and test2 vars. int main(int argc, char* argv[])
{
using namespace GetOpt;
int test1 = 10;
float test2 = 3.14f;
GetOpt_pp ops(argc, argv);
ops >> Option('i', "test1", test1) >> Option('f', test2);
std::cout << test1 << "\n" << test2 << "\n";
return 0;
}See the project's Wiki for documentation. Current version: 2.13 Development version: 2.15, which contains support for long flag options alone. Please try it! DonationsGetOpt_pp is maintained at FuDePAN, an NGO/NPO for bioinformatics research. If you find GetOpt_pp useful, please consider to donate so we can keep up the research and maintenance. Coming in GetOpt_pp 3.0: environment stream for inserting and extracting env vars! Don't miss GetOpt_pp Episode 3! This project belongs to FuDePAN.
|
