<html>
<head>
<title>firstworks   Programming with Rudiments using the commandline class</title>
<link href="../css/styles.css" rel="stylesheet">
</head>
<body>

<span class="heading">Using the commandline class</span><br><br>

<p>The <a href="../classes/html/classcommandline.html">commandline class</a> provides methods for parsing command line arguments.</p>

<p>Most programs take command line options in the option/value pair format:</p>

<blockquote>program -option value -option value ...</blockquote>

<p>or</p>

<blockquote>program --option=value --option=value ...</blockquote>

<p>The commandline class makes it easy to deal with command line options of
either of these formats.</p>

<p>The found() method returns true if the option is found and false otherwise.  The getValue() method returns the value of the option or an empty string if the option wasn't specified.</p>

<p>The following program greets the user and takes two arguments:</p>

<ul>
<li>-hello</li>
<li>-name <i>name</i></li>
</ul>

<p>If -hello is specified then the user is greeted with "hello", rather than "hi".  If -name is specified then the user is greeted by name.</p>

<blockquote class="code">
@commandline.cpp.html@
</blockquote>

</body>
</html>
