LOCALECONV(3P) | POSIX Programmer's Manual | LOCALECONV(3P) |
PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.NAME
localeconv - return locale-specific informationSYNOPSIS
#include <locale.h>DESCRIPTION
The localeconv() function shall set the components of an object with the type struct lconv with the values appropriate for the formatting of numeric quantities (monetary and otherwise) according to the rules of the current locale.The members of the structure with type char * are pointers to strings, any of which (except decimal_point) can point to "", to indicate that the value is not available in the current locale or is of zero length. The members with type char are non-negative numbers, any of which can be {CHAR_MAX} to indicate that the value is not available in the current locale.
The members include the following:
- char *decimal_point
-
- char *thousands_sep
-
- char *grouping
-
- char *int_curr_symbol
-
- char *currency_symbol
-
- char *mon_decimal_point
-
- char *mon_thousands_sep
-
- char *mon_grouping
-
- char *positive_sign
-
- char *negative_sign
-
- char int_frac_digits
-
- char frac_digits
-
- char p_cs_precedes
-
- char p_sep_by_space
-
- char n_cs_precedes
-
- char n_sep_by_space
-
- char p_sign_posn
-
- char n_sign_posn
-
- char int_p_cs_precedes
-
- char int_n_cs_precedes
-
- char int_p_sep_by_space
-
- char int_n_sep_by_space
-
- char int_p_sign_posn
-
- char int_n_sign_posn
-
The elements of grouping and mon_grouping are interpreted according to the following:
- {CHAR_MAX}
- No further grouping is to be performed.
- 0
- The previous element is to be repeatedly used for the remainder of the digits.
- other
-
The integer value is the number of digits that comprise the current group. The next element is examined to determine the size of the next group of digits before the current group.
The values of p_sep_by_space, n_sep_by_space, int_p_sep_by_space, and int_n_sep_by_space are interpreted according to the following:
- 0
- No space separates the currency symbol and value.
- 1
- If the currency symbol and sign string are adjacent, a space separates them from the value; otherwise, a space separates the currency symbol from the value.
- 2
-
If the currency symbol and sign string are adjacent, a space separates them; otherwise, a space separates the sign string from the value.
For int_p_sep_by_space and int_n_sep_by_space, the fourth character of int_curr_symbol is used instead of a space.
The values of p_sign_posn, n_sign_posn, int_p_sign_posn, and int_n_sign_posn are interpreted according to the following:
- 0
- Parentheses surround the quantity and currency_symbol or int_curr_symbol.
- 1
- The sign string precedes the quantity and currency_symbol or int_curr_symbol.
- 2
- The sign string succeeds the quantity and currency_symbol or int_curr_symbol.
- 3
- The sign string immediately precedes the currency_symbol or int_curr_symbol.
- 4
-
The sign string immediately succeeds the
currency_symbol or
int_curr_symbol.
The implementation shall behave as if no function in this volume of IEEE Std 1003.1-2001 calls localeconv().
The localeconv() function need not be reentrant. A function that is not required to be reentrant is not required to be thread-safe.
RETURN VALUE
The localeconv() function shall return a pointer to the filled-in object. The application shall not modify the structure pointed to by the return value which may be overwritten by a subsequent call to localeconv(). In addition, calls to setlocale() with the categories LC_ALL, LC_MONETARY, or LC_NUMERIC may overwrite the contents of the structure.ERRORS
No errors are defined.The following sections are informative.
EXAMPLES
None.APPLICATION USAGE
The following table illustrates the rules which may be used by four countries to format monetary quantities.For these four countries, the respective values for the monetary members of the structure returned by localeconv() are:
RATIONALE
None.FUTURE DIRECTIONS
None.SEE ALSO
isalpha(), isascii(), nl_langinfo(), printf(), scanf(), setlocale(), strcat(), strchr(), strcmp(), strcoll(), strcpy(), strftime(), strlen(), strpbrk(), strspn(), strtok(), strxfrm(), strtod(), the Base Definitions volume of IEEE Std 1003.1-2001, <langinfo.h>, <locale.h>COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .2003 | IEEE/The Open Group |