Example: lrd_assignVariable Handling Functions

Assigns a null-terminated string value to a variable through its descriptor.

LRDRET lrd_assign( LRD_VAR_DESC *mptVarDesc, char *mpcValStr, char *mpszValStrFmt, unsigned long muliIndex, long mliOffset );

mptVarDesc A pointer to the variable descriptor to which the value is being assigned.
mpcValStr A pointer to the input value string, or NULL. If the value is not NULL, the string can be parameterized.
mpszValStrFmt The input value format: LRD_VAL_STR_FMT_ type where type can be DFLT or RAW.
muliIndex The zero-based index of the array element to set (zero for non-array variables).
mliOffset The offset within the host variable indicating the location at which to assign a value to the variable. For example, if the variable has a prefix that you want to retain, set the offset to a value greater than the size of the prefix.

The lrd_assign function assigns a null-terminated string, either literal or a storage area, to a variable via its descriptor. If necessary, the string is converted to the variable's data type and length. To include a null character ('\0') in your string, or If the string is not null-terminated, use lrd_assign_ext or lrd_assign_literal. You can only assign a NULL value for lrd_assign, by specifying NULL or 0 (without quotation marks).

Note that when the placeholder variable is an array, this function assigns a value to a single element of the array. This function must precede its corresponding lrd_bind_placeholder.

For more details refer to the Function Header File lrd.h in the include directory.

Return Values

See LRD Return Values.


The following argument can be parameterized using standard parameterization: mpcValStr