The ifx_var_alloc() function

The ifx_var_alloc() function allocates memory for the data buffer of an lvarchar or var binary host variable.

Syntax

var binary
mint ifx_var_alloc(var_bin, var_size)
   var binary **var_bin
      int4 var_size;
lvarchar
mint ifx_var_alloc(lvar, var_size)
   lvarchar **lvar
   int4 var_size;
var_bin
The address of the var binary pointer host variable whose data buffer is allocated.
lvar
The address of the lvarchar pointer host variable whose data buffer is allocated.
var_size
The size, in bytes, of the data buffer to allocate.

Usage

The allocation flag of the ifx_var_flag() function notifies Informix® ESQL/C of the allocation method to use for the data buffer. If you set the allocation flag in ifx_var_flag() to 0, you must explicitly allocate memory for the data buffer of a var binary host variable with the ifx_var_alloc() function.
Important: Whether you allocate memory or allow Informix® ESQL/C to allocate the memory for you, you must free the allocated memory by using the ifx_var_dealloc() function.

Return codes

0
The function was successful.
<0
The function was not successful and the return value indicates the cause of the error.