Utility Functions and C Language Reference > Utility Functions: C Language (lr_) > Alphabetical Listing > lr_eval_string_ext

lr_eval_string_ext

Creates a buffer and assigns it the input string after evaluating embedded parameters.

C Language

int lr_eval_string_ext( const char *in_string, unsigned long const in_len, char ** const out_str, unsigned long * const out_len, unsigned long const options, const char *file, long const line );

Example: lr_eval_string_ext Parameter Functions

Arguments

Name Comments
in_str The string to be evaluated.
in_len The length of the name of argument in_str +2 to account for the parentheses.
out_str A pointer to the output buffer.
out_len The length of the output buffer.
options Reserved for future use. Currently set to "0".
file Reserved for future use. Currently set to "0".
line Reserved for future use. Currently set to "-1".

The lr_eval_string_ext function evaluates in_str by replacing parameters with their string value. It creates a buffer containing the expanded string and sets out_str to point to that buffer. It also assigns the length of the buffer to out_len.

Note that in_len is the length of the argument you pass, and not the length of the value of the parameter. For example, if parameter ABC contains the string "1234567890", the call is:

lr_eval_string_ext ("{ABC}", 5

After using lr_eval_string_ext, free the memory allocated for the output buffer with lr_eval_string_ext_free.

This function is useful when correlating statements that use binary data, for example, data with embedded NULL characters.

Use this function in conjunction with lr_eval_string_ext_free in preference to lr_eval_string when evaluating strings in a loop. Using lr_eval_string in a loop uses more memory.

Return Values

This function returns the value of the specified string or null on error.

Parameterization

All arguments can be parameterized using standard parameterization.