Share this page

# lr_save_var

Saves a variable length string to a parameter.

    int lr_save_var( char *param_value, unsigned long const value_len, unsigned long const options, char *param_name );

Alphabetical Listing - C Language Utility Functions

## Arguments

Name | Comments
--- | ---
param_value | The value to assign to a parameter.
value_len | The length of the value in bytes.
options | A parameter option, currently 0.
param_name | The name of the parameter.

The lr_save_var function assigns the specified variable length string to a parameter. This function is useful in Correlating Statements. To determine the value of the parameter, use the lr_eval_string function.

Do not:

- save an input buffer that contains null or other binary data.
- pass a value_len longer than the actual data.

In these cases, lr_save_var saves binary data. The behavior of a script that uses the parameter value is indeterminate.

## Return Values

This function returns 0 on success and 1 on failure.

## Parameterization

You cannot use standard parameterization for any arguments in this function.

## Example

In the following example, lr_save_var limits the length of a parameter.

Copy code

    Action()
    {
        #define MAX_NAME_LEN 4

    // Create the parameter, InName
        lr_save_string("Fitzwilliam", "InName");

    // Save the first four characters of "InName" to "ShortName"
        lr_save_var( lr_eval_string("{InName}"),
            MAX_NAME_LEN, 0, "ShortName");

        lr_output_message("ShortName value is %s", lr_eval_string("{ShortName}"));

        return 0;
    }

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: