[#BloombergLP-balcl-CommandLine-parse-0c] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balcl.adoc[balcl]::xref:BloombergLP/balcl/CommandLine.adoc[CommandLine]::parse :relfileprefix: ../../../ :mrdocs: Parse the command‐line arguments in `argv` of length `argc`. == Synopsis Declared in `<balcl_commandline.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int parse( int argc, char const const* argv[]); ---- == Description Optionally specify an `errorStream` to which an appropriate error message is written if parsing fails. If `errorStream` is not specified, `bsl::cerr` is used. Return 0 on success, and a non‐zero value otherwise. If an argument is not specified on the command‐line, then if the `Option` object configuration for this `CommandLine` defines an environment variable name and the runtime environment for this application has set that environment variable, then set the option to the value of the environment variable. Otherwise, if an option is not set by the command line, or the environment, set the option using the default value if one has been provided. If the option has not been set by the command line, environment, or by default, `hasValue` for the option will return `false`. After a successful call `isParsed()` and `isValid()` will both be `true`, and the information provided by `argv` can be viewed via the accessors. After an unsuccessful call `isParsed()` and `isValid()` will both be `false`. The behavior is undefined unless `isValid()` is `true` and `isParsed()` is `false` (i.e. the `CommandLine` was constructed in a valid state, and `parse` has not previously been called). == Return Value 0 on success, and a non‐zero value otherwise == Parameters [cols="1,4"] |=== | Name| Description | *argc* | length of the `argv` array | *argv* | array of command‐line argument strings |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#