My favorites | Sign in
Project Logo
             
Show all Featured downloads:
GetOpt_pp-2.13.tgz
People details
Project owners:
  danielgutson

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

Coming soon: environment stream for inserting and extracting env vars!

Don't miss GetOpt_pp Episode 3!

This project belongs to FuDePAN.









Hosted by Google Code