projects
One aspect of writing an effective application is flexibility- what are the expected behaviors of the program, and how can we enable the widest range of configuration changes without needing to recompile the code?
As far as run-time configuration goes, there are two options immediately available to us:
Now we get to explore the further implementation of these concepts.
Many of you have likely encountered some aspects of accessing the command-line, typically through setting and using parameters in the main() function (via the venerable and oft-named argc and argv variables), but even then, we often kept things simple as the nature of parsing arguments can add complexity.
Luckily, functionality exists which does the bulk of the parsing work for us, so we will familiarized ourselves with that. It is known as getopt(), and it has a manual page. So: