Allocate vector elements.
MCO_RET mco_uda_field_alloc( /*IN*/ const mco_uda_object_handle_p obj,
/*IN*/ unsigned short field_no,
/*IN*/ unsigned short length );
| obj | The object handle |
|
field_no |
The field number (must be between 0 and |
|
length |
The number of elements to allocate |
Allocate a vector field.
| MCO_S_OK | Vector field successfully allocated |
| MCO_E_UDA_FIELD_NOT_FOUND |
Invalid |
|
MCO_E_UDA_NOT_DYNAMIC |
The field referenced by |
Application snippet:
int main(int argc, char* argv[])
{
MCO_RET rc;
mco_uda_object_handle_t obj;
mco_uda_value_t val;
unsigned short field_no = 1;
unsigned short vlength = 3;
char buf[1024];
...
/* Put a vector of chars */
mco_uda_field_alloc(&obj, field_no, vLength); /* Allocate vector */
val.type = MCO_DD_CHAR; /* Set field's type */
val.v.p.p.c = buf; /* Set pointer to buffer */
val.v.p.len = 20; /* Set string length */
for (j = 0; j < vLength; ++j)
{
sprintf(buf, "vch-%d:%d", 1, j); /* Put value to buffer */
mco_uda_put(&rec, field_no, j, &val); /* Put value to object */
}
...
}