Next: Global Variables
Up: Programming Utilities
Previous: Programming Utilities
Simple command line argument processing is provided. Note that more
sophisticated and extensive argument processing can be provided by
other existing packages around the lab. Nevertheless, command line
argument lists can be scanned in command line order as follows:
public void initialize_argument_processing(
int argc,
char *argv[] )
-
- called once to let the argument processor know what the command line
arguments are. Initializes the current argument to the first
argument, in preparation for sequential processing of the command line
arguments.
public BOOLEAN get_int_argument(
int default_value,
int *value )
public BOOLEAN get_real_argument(
Real default_value,
Real *value )
public BOOLEAN get_string_argument(
char default_value[],
char *value[] )
-
- checks if there is a current argument and that it
is of the desired type. If so,
then it assigns the appropriate value, advances to the next
argument, and returns TRUE. Otherwise, the default value is assigned
to the value and the current argument is not advanced.
public BOOLEAN get_prefix_argument(
char prefix[] )
-
- checks if the next argument starts with the given prefix and if so,
advances to the point in the argument just after the end of the prefix, or
to the next argument if there are no characters after the prefix.
Returns TRUE if the command line argument starts with the prefix.
Next: Global Variables
Up: Programming Utilities
Previous: Programming Utilities