collorder() — Return list of collating elements

Standards

Standards / Extensions C or C++ Dependencies
Language Environment both  

Format

#include <collate.h>

int collorder(collel_t **list);

General description

Finds the number of collating elements in the collate order list and sets a pointer to the list. The list returned is valid until another call to setlocale().

Notes:
  1. Collating elements specified with the weight of IGNORE in the LC_COLLATE category are defined as having the lowest weight.
  2. The list will only contain characters defined in the charmap file in the current locale.

Example

CELEBC23
⁄* CELEBC23

   This example creates a list of all the collating elements using
   the &collo. function.

 *⁄
#include <stdio.h>
#include <locale.h>
#include <collate.h>
#include <wchar.h>
#include <wctype.h>

main(int argc, char *argv[]) {
   collel_t e, *rp;
   int i;

   setlocale(LC_ALL, "TEXAN.IBM-1024");
   i = collorder(&rp);
   for (; i-- > 0; rp++) {
      if (ismccollel(*rp))
         printf("'%s' ", colltostr(*rp));
      else if (iswprint(*rp))
         printf("'%lc' ", *rp);
      else
         printf("'%x' ", *rp);
   }
}

Related information