wcslocaleconv() — Retrieve Wide Locale Information

Format

#include <locale.h>
struct wcslconv *wcslocaleconv(void);

Language Level: Extended

Threadsafe: Yes.

Locale Sensitive: The behavior of this function might be affected by the LC_UNI_NUMERIC and LC_UNI_MONETARY categories of the current locale. This function is only available when LOCALETYPE(*LOCALEUCS2) or LOCALETYPE(*LOCALEUTF) is specified on the compilation command. For more information, see Understanding CCSIDs and Locales.

Wide Character Function: See Wide Characters for more information.

Description

The wcslocaleconv() function is the same as the localeconv function, except that it returns a pointer to a wcslconv structure, which is the wide version of a lconv structure. These elements are determined by the LC_UNI_MONETARY and LC_UNI_NUMERIC categories of the current locale.

Return Value

The wcslocaleconv() function returns a pointer to a wcslconv structure.

Example that uses wcslocaleconv()

This example prints out the Unicode currency symbol for a French locale.

/************************************************************************
This example prints out the Unicode currency symbol for a French 
locale.  You first must create a Unicode French locale.  You can do 
this with this command:
CRTLOCALE LOCALE('QSYS.LIB/MYLIB.LIB/LC_UNI_FR.LOCALE') +
SRCFILE('QSYS.LIB/QSYSLOCALE.LIB/QLOCALESRC.FILE/ +
FR_FR.MBR') CCSID(13488)

Then you must compile your c program with LOCALETYPE(*LOCALEUCS2)
************************************************************************/
#include <stdio.h>
#include <locale.h>
int main(void) {
char * string;
struct wcslconv * mylocale;
if (NULL != (string = setlocale(LC_UNI_ALL,
"QSYS.LIB/MYLIB.LIB/LC_UNI_FR.LOCALE"))) {
mylocale = wcslocaleconv();
/* Display the Unicode currency symbol in a French locale */
printf("French Unicode currency symbol is a %ls\n", mylocale->currency_symbol);
} else {
printf("setlocale(LC_UNI_ALL, \"QSYS.LIB/MYLIB.LIB/LC_UNI_FR.LOCALE\") \
returned <NULL>\n");
}

return 0;
}

Related Information



[ Top of Page | Previous Page | Next Page | Contents | Index ]