# mco_dict_struct
RT

> Return a structure/class descriptor.

### Prototype

        MCO_RET mco_dict_struct(	/*IN*/ mco_metadict_header_t * metadict,
                      /*IN*/ unsigned short dict_no,
                      /*IN*/ unsigned short struct_no,
                      /*OUT*/ mco_dict_struct_info_t * struct_info );

### Arguments

metadict | The address of an initialized mco_metadict_header_t structure
dict_no | The number of the dictionary (must be between 0 and `mco_metadict_count().` - 1)
struct_no | The structure/class number (must be between 0 and `mco_dict_struct_count()` - 1)
struct_info | The address of a `mco_dict_struct_info_t` variable to receive the structure/class descriptor

### Description

> This function returns the structure/class descriptor referred to by the index `dict_no` in the array `metadict->entries[]` and class/structure number `struct_no` .

### Return Codes

MCO_S_OK | The structure/class descriptor was successfully returned
MCO_E_UDA_DICT_NOTFOUND | The dictionary is not registered
MCO_E_UDA_STRUCT_NOTFOUND | Invalid `struct_no`

### Example

        Application snippet:

        const char * dbname = "SimpleDb";

        int main(int argc, char* argv[])
        {
            MCO_RET rc;
            unsigned int dict_no = 0;
            unsigned int count;
            mco_metadict_header_t *header;

            ...

            header = (mco_metadict_header_t *) malloc(size);
            mco_metadict_init(header, size); /* initialize the metadict */
            ...
            mco_dict_struct_count(header, dict_no, &count);
            for (i = 0; i < count; ++i)
            {
                mco_dict_struct_info_t struct_info;
                /* get structure descriptor */
                rc = mco_dict_struct(header, dict_no, i, &struct_info);

                if (struct_info.flags & MCO_DICT_SI_CLASS) {
                    printf("Class %d     : %s\n", i, struct_info.name);
                } else {
                    printf("Structure %d : %s\n", i, struct_info.name);
                }
            }
            ...
        }

### Files

Header file:
mcouda.h
Source file:
mcouda.c
Library:
libmcouda.a