lr_param_increment
Increments the value of a numerical parameter.
C Language
int lr_param_increment( char *destination_param, char *source_param );
Example: lr_param_increment | Runtime Functions |
Arguments
Name | Comments |
---|---|
destination_param | The name of the parameter to store the incremented parameter |
source_param | The name of the parameter whose value is incremented |
The lr_param_increment function retrieves the value of source_param, increments its value by one, and stores the incremented value as a null terminated string in destination_param.
This function is useful only in protocols that have a numerical parameter type. For protocols that have only string parameters, increment with C functions. For example:
i = atoi(lr_eval_string("{modification_num}")); sprintf(buf, "%d", i+1); lr_save_string(buf, "next_modnum");
For protocols that have a numerical parameter, lr_param_increment can be used:
lr_param_increment("next_modnum", "{modification_num}");
source_param must be initialized with an integer value prior to calling lr_param_increment. source_param's value should include only single-byte digit characters with an optional sign or leading zeros.
When destination_param exists, its value is overwritten. When it doesn't exist, the parameter is created dynamically.
The value of source_param is restricted to the maximum value of a long integer minus 1.
Return Values
This function returns the following values:
Enum | Value | Result |
---|---|---|
LR_PARAM_INC_OK | 0 | Success |
LR_PARAM_INC_ERR_SAVE_FAILED | -1 | The save operation to the destination parameter failed. |
LR_PARAM_INC_ERR_MBCS_IN_SRC | -2 | The source parameter includes multibyte characters, which indicates that it is not a pure numeric parameter. |
LR_PARAM_INC_ERR_SRC_NOT_NUM | -3 | The source parameter includes singlebyte characters that are not digits, or the source parameter does not exist. |
LR_PARAM_INC_ERR_EVAL_FAILED | -4 | The evaluation operation of the source parameter failed. |
Parameterization
Standard parameterization is not available for this function.