Skip Navigation Links | |
Exit Print View | |
man pages section 3: Basic Library Functions Oracle Solaris 11.1 Information Library |
enable_extended_FILE_stdio(3C)
posix_spawnattr_getschedparam(3C)
posix_spawnattr_getschedpolicy(3C)
posix_spawnattr_getsigdefault(3C)
posix_spawnattr_getsigignore_np(3C)
posix_spawnattr_getsigmask(3C)
posix_spawnattr_setschedparam(3C)
posix_spawnattr_setschedpolicy(3C)
posix_spawnattr_setsigdefault(3C)
posix_spawnattr_setsigignore_np(3C)
posix_spawnattr_setsigmask(3C)
posix_spawn_file_actions_addclose(3C)
posix_spawn_file_actions_addclosefrom_np(3C)
posix_spawn_file_actions_adddup2(3C)
posix_spawn_file_actions_addopen(3C)
posix_spawn_file_actions_destroy(3C)
posix_spawn_file_actions_init(3C)
pthread_attr_getdetachstate(3C)
pthread_attr_getinheritsched(3C)
pthread_attr_getschedparam(3C)
pthread_attr_getschedpolicy(3C)
pthread_attr_setdetachstate(3C)
pthread_attr_setinheritsched(3C)
pthread_attr_setschedparam(3C)
pthread_attr_setschedpolicy(3C)
pthread_barrierattr_destroy(3C)
pthread_barrierattr_getpshared(3C)
pthread_barrierattr_setpshared(3C)
pthread_condattr_getpshared(3C)
pthread_condattr_setpshared(3C)
pthread_cond_reltimedwait_np(3C)
pthread_key_create_once_np(3C)
pthread_mutexattr_getprioceiling(3C)
pthread_mutexattr_getprotocol(3C)
pthread_mutexattr_getpshared(3C)
pthread_mutexattr_getrobust(3C)
pthread_mutexattr_setprioceiling(3C)
pthread_mutexattr_setprotocol(3C)
pthread_mutexattr_setpshared(3C)
pthread_mutexattr_setrobust(3C)
pthread_mutex_getprioceiling(3C)
pthread_mutex_reltimedlock_np(3C)
pthread_mutex_setprioceiling(3C)
pthread_rwlockattr_destroy(3C)
pthread_rwlockattr_getpshared(3C)
pthread_rwlockattr_setpshared(3C)
pthread_rwlock_reltimedrdlock_np(3C)
pthread_rwlock_reltimedwrlock_np(3C)
pthread_rwlock_timedrdlock(3C)
pthread_rwlock_timedwrlock(3C)
rctlblk_get_enforced_value(3C)
- get numeric formatting information
#include <locale.h> struct lconv *localeconv(void);
The localeconv() function sets the components of an object with type struct lconv (defined in <locale.h>) with the values appropriate for the formatting of numeric quantities (monetary and otherwise) according to the rules of the current locale (see setlocale(3C)). The definition of struct lconv is given below (the values for the fields in the “C” locale are given in comments).
char *decimal_point; /* "." */ char *thousands_sep; /* "" (zero length string) */ 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_MAX */ char frac_digits; /* CHAR_MAX */ char p_cs_precedes; /* CHAR_MAX */ char p_sep_by_space; /* CHAR_MAX */ char n_cs_precedes; /* CHAR_MAX */ char n_sep_by_space; /* CHAR_MAX */ char p_sign_posn; /* CHAR_MAX*/ char n_sign_posn; /* CHAR_MAX */
The following members are also available to SUSv3–conforming applications. See standards(5)
char int_p_cs_precedes; /* CHAR_MAX */ char int_p_sep_by_space; /* CHAR_MAX */ char int_n_cs_precedes; /* CHAR_MAX */ char int_n_sep_by_space; /* CHAR_MAX */ char int_p_sign_posn; /* CHAR_MAX */ char int_n_sign_posn; /* CHAR_MAX */
The members of the structure with type char * are strings, any of which (except decimal_point) can point to a null string (""), 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 (defined in the <limits.h> header) to indicate that the value is not available in the current locale. The members are the following:
The decimal-point character used to format non-monetary quantities.
The character used to separate groups of digits to the left of the decimal-point character in formatted non-monetary quantities.
A string whose elements taken as one-byte integer values indicate the size of each group of digits in formatted non-monetary quantities.
The international currency symbol applicable to the current locale. The first three characters contain the alphabetic international currency symbol in accordance with those specified in the ISO 4217: 1995 standard. The fourth character (immediately preceding the null byte) is the character used to separate the international currency symbol from the monetary quantity.
The local currency symbol applicable to the current locale.
The decimal point used to format monetary quantities.
The separator for groups of digits to the left of the decimal point in formatted monetary quantities.
A string whose elements taken as one-byte integer values indicate the size of each group of digits in formatted monetary quantities.
The string used to indicate a non-negative-valued formatted monetary quantity.
The string used to indicate a negative-valued formatted monetary quantity.
The number of fractional digits (those to the right of the decimal point) to be displayed in an internationally formatted monetary quantity.
The number of fractional digits (those to the right of the decimal point) to be displayed in a formatted monetary quantity.
Set to 1 or 0 if the currency_symbol respectively precedes or succeeds the value for a non-negative formatted monetary quantity.
Set to 0 if no space separates the currency_symbol or int_curr_symbol from the value for a non-negative formatted monetary quantity. Set to 1 if a space separates the symbol from the value; and set to 2 if a space separates the symbol and the sign string, if adjacent.
Set to 1 or 0 if the currency_symbol respectively precedes or succeeds the value for a negative formatted monetary quantity.
Set to 0 if no space separates the currency_symbol or int_curr_symbol from the value for a negative formatted monetary quantity. Set to 1 if a space separates the symbol from the value; and set to 2 if a space separates the symbol and the sign string, if adjacent.
Set to a value indicating the positioning of the positive_sign for a non-negative formatted monetary quantity.
Set to a value indicating the positioning of the negative_sign for a negative formatted monetary quantity.
Set to 1 or 0 if the int_curr_symbol respectively precedes or succeeds the value for a non-negative internationally formatted monetary quantity.
Set to 1 or 0 if the int_curr_symbol respectively precedes or succeeds the value for a negative internationally formatted monetary quantity.
Set to a value indicating the separation of the int_curr_symbol, the sign string, and the value for a non-negative internationally formatted monetary quantity.
Set to a value indicating the separation of the int_curr_symbol, the sign string, and the value for a negative internationally formatted monetary quantity.
Set to a value indicating the positioning of the positive_sign for a non-negative internationally formatted monetary quantity.
Set to a value indicating the positioning of the negative_sign for a negative internationally formatted monetary quantity.
The elements of grouping and mon_grouping are interpreted according to the following:
No further grouping is to be performed.
The previous element is to be repeatedly used for the remainder of the digits.
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:
No space separates the currency symbol and value.
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.
If the currency symbol and sign string are adjacent, a space separates them; otherwise, a space separates the sign string from the value.
In an SUSv3–conforming application, 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:
Parentheses surround the quantity and currency_symbol or int_curr_symbol.
The sign string precedes the quantity and currency_symbol or int_curr_symbol.
The sign string succeeds the quantity and currency_symbol or int_curr_symbol.
The sign string immediately precedes the currency_symbol or int_curr_symbol.
The sign string immediately succeeds the currency_symbol or int_curr_symbol.
The localeconv() function returns a pointer to the filled-in object. The structure pointed to by the return value may be overwritten by a subsequent call to localeconv().
Example 1 Rules used by four countries to format monetary quantities.
The following table illustrates the rules 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 as follows:
|
See attributes(5) for descriptions of the following attributes:
|
The localeconv() function can be used safely in multithreaded applications, as long as setlocale(3C) is not being called to change the locale.