2.7.13. lconv 结构

lconv 结构包含数字格式信息。 该结构由 _get_lconv()localeconv() 函数填充。

Example 2.9 显示了 locale.h 中的 lconv 定义。

Example 2.9. lconv 结构


struct lconv {

  char *decimal_point;

       /* The decimal point character used to format non monetary quantities */	

  char *thousands_sep;	

       /* The character used to separate groups of digits to the left of the */	

       /* decimal point character in formatted non monetary quantities.      */	

  char *grouping;

       /* A string whose elements indicate the size of each group of digits  */	

       /* in formatted non monetary quantities. See below for more details.  */	

  char *int_curr_symbol;

       /* 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 ISO 4217.    */	

       /* Codes for the representation of Currency and Funds. The fourth     */	

       /* character (immediately preceding the null character) is the        */	

       /* character used to separate the international currency symbol from  */	

       /* the monetary quantity.                                             */	

  char *currency_symbol;	

       /* The local currency symbol applicable to the current locale.        */	

  char *mon_decimal_point;	

       /* The decimal-point used to format monetary quantities.              */	

  char *mon_thousands_sep;	

       /* The separator for groups of digits to the left of the decimal-point*/	

       /* in formatted monetary quantities.                                  */	

  char *mon_grouping;	

       /* A string whose elements indicate the size of each group of digits  */	

       /* in formatted monetary quantities. See below for more details.      */	

  char *positive_sign;	

       /* The string used to indicate a non negative-valued formatted         */	

       /* monetary quantity.                                                 */	

  char *negative_sign;	

       /* The string used to indicate a negative-valued formatted monetary   */	

       /* quantity.                                                          */	

  char int_frac_digits;	

       /* The number of fractional digits (those to the right of the         */	

       /* decimal-point) to be displayed in an internationally formatted     */	

       /* monetary quantities.                                               */	

  char frac_digits;	

       /* The number of fractional digits (those to the right of the         */	

       /* decimal-point) to be displayed in a formatted monetary quantity.   */	

  char p_cs_precedes;	

       /* Set to 1 or 0 if the currency_symbol respectively precedes or      */	

       /* succeeds the value for a non negative formatted monetary quantity. */	

  char p_sep_by_space;	

       /* Set to 1 or 0 if the currency_symbol respectively is or is not     */	

       /* separated by a space from the value for a non negative formatted   */	

       /* monetary quantity.                                                 */	

  char n_cs_precedes;	

       /* Set to 1 or 0 if the currency_symbol respectively precedes or      */	

       /* succeeds the value for a negative formatted monetary quantity.     */	

  char n_sep_by_space;	

       /* Set to 1 or 0 if the currency_symbol respectively is or is not     */	

       /* separated by a space from the value for a negative formatted       */	

       /* monetary quantity.                                                 */	

  char p_sign_posn;	

       /* Set to a value indicating the position of the positive_sign for a  */	

       /* non negative formatted monetary quantity. See below for more details*/	

  char n_sign_posn;	

       /* Set to a value indicating the position of the negative_sign for a  */	

       /* negative formatted monetary quantity. */	

};

groupingnon_grouping 的元素(如Example 2.9 中所示)解释如下:

CHAR_MAX

不再执行额外的分组。

0

其余数字重复前面的元素。

其他

此值是组成当前组的数字个数。 将检查下一个元素,以确定当前组左侧的下一组数字的大小。

p_sign_posnn_sign_posn 的值(如Example 2.9 中所示)解释如下:

0

将数量和货币符号用括号括起来。

1

将符号字符串放在数量和货币符号前面。

2

将符号字符串放在数量和货币符号后面。

3

将符号字符串紧靠货币符号前面放置。

4

将符号字符串紧靠货币符号后面放置。

Copyright © 2007 ARM Limited. All rights reserved. ARM DUI 0349AC
Non-Confidential