SimApi Control getCommandLineParameterValue 1
static bool SimApi::Control::getCommandLineParameterValue(CCHAR_A *parameterName, CHAR_A *buffer, int &size)
Description
Gets the value of a command line parameter ANSI.
Parameters
parameterName - The name of the command line parameters for which the function will return the value.
buffer - The value of the command line parameter.
size - The buffer size. This integer will be initialized with the value buffer size.
Return
Type: bool Description: True, if suceeded; Otherwise, false.
Remarks
This function is typically used when a plugin (plg file) gets some information from the simulation command line. Example: A plugin that recieves a file path in order to export some data during a session.
Code Sample
//This function sets new rate according to a command line parameter.
//The addition to the command line parameters is : "/rate 4"
//SetSimulationRateFromCommandLine can be called in the init() function of an Extension SIMbox Project.
private void SetSimulationRateFromCommandLine()
{
STRING param = "rate";
CHAR_A value[1024];
int size = 0;
getCommandLineParameterValue(param, value, size);
STRING valueStr(value);
int rate = SimUtil::StringToInt(valueStr);
//if the rate value is in the right range
if(rate >= 1 && rate < 16)
{
//set the rate with the new command line rate.
SimApi::Control::SetRate(rate);
}
}
See Also
getCommandLineParameterValue
addCommandLineParameter