This example shows how to convert a monetary value to a Unicode string using the specified locale object.

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

int main(void) {

LocaleObject locale_object = NULL;

UniChar      ucs[20];
int          max_size = 20;
int          elements;
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;
         }

         /* elements contains number of code elements placed into ucs */

         elements = UniStrfmon(locale_object, ucs,
                               max_size, (UniChar *)L"%n", 123.45);

         return (ULS_SUCCESS);


}


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