args, a C code which demonstrates the retrieval of command line arguments.
This shows how a program can count and retrieve the individual command line arguments with which it was invoked. Thus, if our executable is called fu and we invoke it with the command
fu man chuthen our argument counter will return the value 3, and the arguments, indexed by 0, 1 or 2, will return the values fu, man or chu.
The information on this web page is distributed under the MIT license.
args is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.