Command line arguments in C and C++ with gengetopt
Gengetopt is a tool for parsing command line arguments in C and C++ applications. It generates cmdline.c
and cmdline.h
files in pure C, which contain parser, helper functions, error handling and structure to store argument values. Arguments to be included in auto-generated file are defined in config. I usually gengetopt config file as cmdline.ggo
. In this note I provide an example of gengetopt config file and arguments usage in code.