======Matrix Multiplier Part II: Altering Program Behavior via Configuration====== =====Overview===== 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: * read settings from a configuration file * specify settings via the command-line Now we get to explore the further implementation of these concepts. =====Command-Line Arguments===== 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: * read through **getopt(3)** manual page (remember what the **3** indicates and how to make use of it?) * compile, run, analyze, and figure out the code samples found in that manual page * implement both file output and getopt options in your matrix multiplier ===options to implement=== * -h/-?/--help display usage information (arguments) * -o file/--out file specify output file for resultant matrix * -m/--mirror extra: options on 2nd matrix the same on 1st * -v/--verbose display more of what is going on * -q/--quiet don't output anything * -V/--version display version information * -M # matrix1's row count * -N # matrix1's col count / matrix2's row count * -P # matrix2's col count * -1 file/--in1 file specify input file for matrix1 * -2 file/--in2 file specify input file for matrix2