This example shows how to retrieve a locale category name.

int main(void) {

LocaleObject      locale_object = NULL;
UniChar           *plocale_name;
int               rc = ULS_SUCCESS;


         /* Retrieve locale name of default locale */

         rc = UniQueryLocaleObject(NULL,
                                   LC_ALL,
                                   UNI_UCS_STRING_POINTER,
                                   (void **)&plocale_name);

         if (rc != ULS_SUCCESS) {
           printf("UniQueryLocaleObject error: return code = %u\n", rc);
           return 1;
         }

         /* Create a locale object based upon the default setting */

         rc = UniCreateLocaleObject(UNI_UCS_STRING_POINTER,
                                   (UniChar *)plocale_name, &locale_object);

         if (rc != ULS_SUCCESS) {
           printf("UniCreateLocaleObject error: return code = %u\n", rc);
           return 1;
         }

         rc = UniFreeMem(plocale_name);

         if (rc != ULS_SUCCESS) {
           printf("UniFreeMem error: return code = %u\n", rc);
           return 1;
         }

         return ULS_SUCCESS;


}


[Back: UniQueryLocaleObject - Related Functions]
[Next: UniQueryLocaleObject - Topics]