lconv - C locale.h

C examples for locale.h:lconv

type

data type

From


<clocale>
<locale.h>

Description

Formatting info for numeric values

Prototype

struct lconv;

Member constants

member type value in "C" locale description
decimal_point char* "." Decimal-point separator used for non-monetary quantities.
thousands_sep char* "" Separators used to delimit groups of digits to the left of the decimal point for non-monetary quantities.
grouping char* "" amount of digits that form each of the groups to be separated by thousands_sep separator for non-monetary quantities.
int_curr_symbol char* "" International currency symbol. like "USD" for U.S.-Dollar
currency_symbol char* "" Local currency symbol, like "$".
mon_decimal_point char* "" Decimal-point separator used for monetary quantities.
mon_thousands_sep char* "" Separators used to delimit groups of digits to the left of the decimal point for monetary quantities.
mon_grouping char* "" Set the amount of digits that form each of the groups separated by mon_thousands_sep separator for monetary quantities.
positive_sign char* "" Sign for nonnegative (positive or zero) monetary quantities.
negative_sign char* "" Sign for negative monetary quantities.
frac_digits char CHAR_MAX Amount of fractional digits to the right of the decimal point for monetary quantities in the local format.
p_cs_precedes char CHAR_MAX Whether the currency symbol should precede nonnegative (positive or zero) monetary quantities.
n_cs_precedes char CHAR_MAX Whether the currency symbol should precede negative monetary quantities.
p_sep_by_space char CHAR_MAX Whether a space should appear between the currency symbol and nonnegative (positive or zero) monetary quantities.
n_sep_by_space char CHAR_MAX Whether a space should appear between the currency symbol and negative monetary quantities.
p_sign_posn char CHAR_MAX Position of the sign for nonnegative (positive or zero) monetary quantities. 0 : Currency symbol and quantity surrounded by parentheses. 1 : Sign before the quantity and currency symbol. 2 : Sign after the quantity and currency symbol. 3 : Sign right before currency symbol. 4 : Sign right after currency symbol. CHAR_MAX : Unspecified.
n_sign_posn char CHAR_MAX Position of the sign for negative monetary quantities. See p_sign_posn above.
int_frac_digits char CHAR_MAX Same as frac_digits, but for the international format (instead of the local format).
int_p_cs_precedes char CHAR_MAX Same as p_cs_precedes, but for the international format.
int_n_cs_precedes char CHAR_MAX Same as n_cs_precedes, but for the international format.
int_p_sep_by_space char CHAR_MAX Same as p_sep_by_space, but for the international format.
int_n_sep_by_space char CHAR_MAX Same as n_sep_by_space, but for the international format.
int_p_sign_posn char CHAR_MAX Same as p_sign_posn, but for the international format.
int_n_sign_posn char CHAR_MAX Same as n_sign_posn, but for the international format.

Demo Code


#include <stdio.h>
#include <locale.h>

int main ()/*from ww w. ja va  2s  .  c om*/
{
  setlocale (LC_MONETARY,"");
  struct lconv * lc;
  lc=localeconv();
  printf ("Local Currency Symbol: %s\n",lc->currency_symbol);
  printf ("International Currency Symbol: %s\n",lc->int_curr_symbol);
  
  printf ("grouping: %s\n",lc->grouping);
  
  return 0;
}

Related Tutorials