This example shows how to create and free a locale information structure.

#include <stdio.h>
#include <unidef.h>

int main(void) {

LocaleObject      locale_object = NULL;
struct UniLconv   *puni_lconv = NULL;
int               rc = ULS_SUCCESS;

         /*****************************************************************/
         /* Assumes LANG environment variable set to a valid locale name, */
         /* such as fr_FR                                                 */
         /*****************************************************************/

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

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

         /* Retrieve locale information */

         rc = UniQueryLocaleInfo(locale_object, &puni_lconv);

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

         printf("Monetary decimal point is %ls\n", puni_lconv->mon_decimal_point);

         /* Free the locale information structure */

         rc = UniFreeLocaleInfo(puni_lconv);

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

         return ULS_SUCCESS;


}


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