Determining the Number or Text for a Choice List Item

Because items are renumbered whenever you insert, delete, or sort choice list items, you may need to determine the number or text associated with any of the choice list items. To do this, use cli_numtxt(), which gets the string associated with a item number, and cli_txtnum(), which returns the item number which corresponds to certain text. These functions are as follows:

int cli_numtxt(bufstp, item_num, clistp)
 
UCHAR *bufstp;
/* String to put item text in
*/
int item_num;
/* Item number to find string for
*/
CLISTPTR clistp;
/* Pointer to choice list to search
*/

int cli_txtnum(stp, clistp)
 
UCHAR *stp;
/* String to search in list for
*/
CLISTPTR clistp;
/* Pointer to choice list to search
*/

The buffer string that you pass to collect the item text should be long enough to hold the longest of the choice list items plus a null terminator, or memory will be corrupted.


Home Contents Previous Next