Page of 234

HP 9000 User Manual Page 104

Computers.
Hide thumbs

Advertisement

char **argv;
{
struct lconv *lconv_ptr;
float
number;
char
*cs_precedes, *cs_succeeds;
if (!setlocale(LC_ALL,
"""
/* pointer to structure returned by
localeconv*/
/* pointers for the preceding currency
symbol and the succeeding currency
symbol*/
/*set the locale*/
fprintf(sterr, "error: cannot set locale\n");
lconv_ptr = localeconv();
number = (float)atof(argv[l]);
/* convert string to a float */
/* if the number is non-negative and the currency symbol precedes a
non-negative formatted monetary quantity OR if the number is
negative and the currency symbol succeeds a negative formatted
monetary quantity set the currency symbol precedes pointer to
the currency symbol */
<rev begin>
if (number >= 0 tt lconv_ptr->p_cs_precedes == 1
I I
number < 0 tt lconv_ptr->n_cs_precedes == 1)
{
<rev end>
}
}
cs_precedes
cs_succeeds
lconv_ptr->currency_symbol;
1111.
,
/* otherwise set the currency symbol succeeds to the currency symbol */
else {
cs_precedes
cs_succeeds
}
1111;
lconv_ptr->currency_symbol;
printf("%s %6.2f %s\n", cs_precedes, number, cs_succeeds);
Other information in the
lconv
structure describes decimal point, thousands
separator, spaces used with the currency symbol, and other locale-specific
formatting information.
Developing International Software
6·27
6

Advertisement

   Related Manuals for HP 9000

Comments to this Manuals

Symbols: 0
Latest comments: