views:

734

answers:

4

Possible Duplicates:
What parameter parser libraries are there for C++?
C++ Parse Command Line Arguments

What is the best C++ command line argument parser that you can suggest?

+7  A: 

Try Boost::Program Options. It allows you to read and parse command lines as well as config files.

thekidder
Does it allow you to show the current and default values? A few years ago I had to implement a wrapper around it to show the effective options (based on parsed configs/args, and not just showing the strings supplied).
wrang-wrang
+4  A: 

I like C's getopt(), but then I'm old. :-)

John Deters
+2  A: 

Boost program_options.

bobbymcr
+2  A: 

Google's gflags

Craig
Looks nice for simple use. I've always liked "options as global variables defined anywhere you please" for small tools. Primitives + string only which can be a big minus.
wrang-wrang