3.5 Example: NWGetUnicodeToMonocaseHandle
/* exumono.c - NWGetUnicodeToMonocaseHandle / NWUnicodeToMonocase */
#define NWL_EXCLUDE_TIME
#define NWL_EXCLUDE_FILE
#include <nwlocale.h>
#include <unicode.h>
#include <string.h>
#include <assert.h>
void main()
{
LCONV lconv;
nint err;
nptr h = NULL;
unicode src[5] = {’A’, ’B’, ’c’, ’d’, 0}; /* Unicode input string */
unicode dest[5];
nuint len;
/* Get the country ID and code page from the operating system. */
NWLlocaleconv(&lconv);
err = NWInitUnicodeTables(lconv.country_id, lconv.code_page);
assert (err == 0);
err = NWGetMonocaseHandle(&h);
assert (err == 0);
err = NWUnicodeToMonocase(h, dest, sizeof(dest)/sizeof(unicode),
src, &len);
assert (err == 0);
assert (unicmp(dest, L"abcd") == 0); /* Unicode output string */
assert (len == 5); /* Output size includes null */
NWFreeUnicodeTables();
}