Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ and command line options

Tags:

c++

getopt

Is it bad form to use the GNU getopt in C++ programs? Is there a C++ specific alternative, or should I still just use getopt?

like image 610
oadams Avatar asked Oct 24 '10 03:10

oadams


People also ask

What is C command line?

C allows a program to obtain the command line arguments provided when the executable is called, using two optional parameters of "main()" named "argc (argument count)" and "argv (argument vector)". The "argc" variable gives the count of the number of command-line parameters provided to the program.

What are command line arguments in C?

What are Command Line Arguments in C? Command line arguments are nothing but simply arguments that are specified after the name of the program in the system's command line, and these argument values are passed on to your program during program execution.


1 Answers

There is nothing wrong with using getopt. There are a multitude of object oriented alternatives floating around including Boost.Program_options, and classes in POCO, and ACE.

like image 136
Duck Avatar answered Nov 15 '22 23:11

Duck