mco_metadict_entry

Return a pointer to a dictionary.

Prototype

    MCO_RET mco_metadict_entry(    /*IN*/ mco_metadict_header_t * metadict,
                    /*IN*/ unsigned short dict_no,
                    /*OUT*/ mco_metadict_entry_t ** entry );

Arguments

metadict
The address of a mco_metadict_header_t structure to initialize.
dict_no
The index of the dictionary: must be between 0 and mco_metadict_count().
entry
The address of a mco_metadict_entry_t structure.

Description

This function returns a pointer to the dictionary based on its index in the array metadict->entries.

Return Codes

MCO_S_OK
The dictionary was successfully returned.
MCO_E_UDA_DICT_NOTFOUND
The dictionary is not registered.

Example

    Application snippet:

    const char * dbname = "SimpleDb";

    int main(int argc, char* argv[])
    {
        MCO_RET rc;
        unsigned int count;
        mco_metadict_header_t *header;
        int i;
        int size;

        mco_metadict_size(10, &size); /* figure out the buffer size to
                             register 10 database dictionaries */
        ...

        header = (mco_metadict_header_t *) malloc(size);
        mco_metadict_init(header, size); /* initialize the metadict */
        ...
        mco_metadict_count(header, &count);
        ...
        for (i = 0; i < count; ++i)
        {
            mco_metadict_entry_t *entry;
            rc = mco_metadict_entry(header, i, &entry); /* get a dictionary */
            printf("Entry %d : %s\n", i, entry->name); /* print out its name */
        }
    }

Files

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