delorie.com/djgpp/doc/libc/libc_537.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

localeconv

Syntax

 
#include <locale.h>

struct lconv *localeconv(void);

Description

This function returns a pointer to a static structure that contains information about the current locale. The structure contains these fields:

char *currency_symbol

A string that should be used when printing local currency.

char *decimal_point

A string that is used to separate the integer and fractional portions of real numbers in printf. Currently, only the first character is significant.

char *grouping

An array of numbers indicating the size of groupings for non-monetary values to the left of the decimal point. The first number is the size of the grouping just before the decimal point. A number of zero means to repeat the previous number indefinitely. A number of CHAR_MAX means to group the remainder of the digits together.

char *int_curr_symbol

A string that should be used when formatting monetary values for local currency when the result will be used internationally.

char *mon_decimal_point

A string that separates the interger and fractional parts of monetary values.

char *mon_grouping

Same as grouping, but for monetary values.

char *negative_sign

A string that is used to represent negative monetary values.

char *positive_sign

A string that is used to represent positive monetary values.

char *thousands_sep

The grouping separator for non-monetary values.

char frac_digits

The number of digits to the right of the decimal point for monetary values.

char int_frac_digits

Like frac_digits, but when formatting for international use.

char n_cs_precedes

If nonzero, the currency string should precede the monetary value if the monetary value is negative.

char n_sep_by_space

If nonzero, the currency string and the monetary value should be separated by a space if the monetary value is negative.

char n_sign_posn

Determines the placement of the negative indication string if the monetary value is negative.

0
($value), (value$)
1
-$value, -value$
2
$value-, value$-
3
-$value, value-$
4
$-value, value$-

char p_cs_precedes
char p_sep_by_space
char p_sign_posn

These are the same as n_*, but for when the monetary value is positive.

Note that any numeric field may have a value of CHAR_MAX, which indicates that no information is available.

Return Value

A pointer to the struct lconv structure.

Portability

ANSI/ISO C C89; C99
POSIX 1003.2-1992; 1003.1-2001

Example

 
struct lconv *l = localeconv;
printf("%s%d\n", l->negative_sign, value);


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004