Skip to content

xParse_Command_Line_UInt

Brian W. Mulligan edited this page Oct 27, 2016 · 5 revisions

unsigned int xParse_Command_Line_UInt(int iArgC,const char * lpszArgV[],const char * i_lpszOption, unsigned int i_uiDefault_Value)

Processes the command line paramters, for a specific option (specified by parameter i_lpszOption), and resolves the value as an unsigned integer. The command line may have one of the following forms:

  • a.out --a = 1 ... <other options>
  • a.out --a= 1 ... <other options>
  • a.out --a =1 ... <other options>
  • a.out --a=1 ... <other options>

where a.out is the program being run, --a is the command line option, and the value of a is 1. There is no limitation to the form of the option - i.e. --param, -param, *param, and param would all be processed. The command line parameters processed using the xParse_Command_Line functions may have any order. If you require ordered data on the command line it is recommended that such data appears at either the beginning or end of the list. Only the first instance of a parameter will be processed, i.e. if the command line is a.out --a=1 --a=2, the value of 1 would be returned for parameter --a.

Parameters

  • iArgC (int): Number of command line argument values in the list
  • lpszArgV (const char * []): array of pointers to command line argument parameters
  • i_lpszOption (const char *): zero-terminated string of the option to search for

Output

  • (unsigned int): user specified value of the command line parameter

Fault response

None