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
field_no
struct_info.field_count - 1).length
Allocate a vector field.
MCO_S_OK
field_no - field not found in this class or struct.MCO_E_UDA_NOT_DYNAMIC
field_no is not a vector.
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;
unsigned short j;
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(&obj, field_no, j, &val); /* Put value to object */
}
...
}