Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

setlocale(3)

localeconv(3)  —  Subroutines

OSF

NAME

localeconv, localeconv_r − Retrieves locale-dependent formatting parameters

LIBRARY

Standard C Library (libc.a)

SYNOPSIS

#include <locale.h>
struct lconv ∗localeconv ( void ) int localeconv_r(
struct lconv ∗result,
char ∗buf,
int len );

PARAMETERS

resultPoints to a lconv structure in which to return the conventions. 

bufPoints to a buffer used for constructing char ∗’s. 

lenSpecifies the length of buf. 

DESCRIPTION

The localeconv() function provides access to the object that specifies the current locale’s conventions for the format of numeric quantities. 

The lconv structure contains values appropriate for formatting numeric quantities (monetary and otherwise) according to the rules of the current locale.  The members of the structure with the 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 nonnegative numbers, any of which can be CHAR_MAX to indicate that the value is not available in the current locale.  The members include the following:

char ∗decimal_point
The decimal-point character used to format nonmonetary quantities.

char ∗thousands_sep
The separator for groups of digits to the left of the decimal point in formatted nonmonetary quantities.

char ∗grouping
A string whose elements indicate the size of each group of digits in formatted nonmonetary quantities.

char ∗int_curr_symbol
The international currency symbol applicable to the current locale, left justified within a four-character, space-padded field.  The character sequences are in accordance with those specified in ISO 4217 Codes for the Representation of Currency and Funds. 

char ∗currency_symbol
The 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.

char ∗positive_sign
The string used to indicate a nonnegative formatted monetary quantity.

char ∗negative_sign
The string used to indicate a negative formatted monetary quantity.

char int_frac_digits
The number of fractional digits (those to the right of the decimal point) to be displayed in a formatted monetary quantity.

char frac_digits
The number of fractional digits (those to the right of the decimal points) to be displayed in a formatted monetary quantity.

char p_cs_precedes
Set to 1 or 0 (zero) if the currency_symbol respectively precedes or succeeds the value for a nonnegative formatted monetary quantity. 

char p_sep_by_space
Set to 1 or 0 (zero) if the currency_symbol respectively is or is not separated by a space from the value for a nonnegative formatted monetary quantity. 

char n_cs_precedes
Set to 1 or 0 (zero) 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 (zero) 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 positioning of the positive_sign for nonnegative formatted monetary quantity. 

char n_sign_posn
Set to a value indicating the positioning of the negative_sign for a negative formatted monetary quantity. 

The elements of grouping and mon_grouping are interpreted according to the following:

MAX_CHAR
No further grouping is to be performed.

0The previous element is to be repeatedly used for the remainder of the digits. 

otherThe 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 to the left of the current group. 

The value of p_sign_posn and n_sign_posn is interpreted according to the following:

0Parenthesis surround the quantity and currency_symbol. 

1The sign string precedes the quantity and currency_symbol. 

2The sign string succeeds the quantity and currency_symbol. 

3The sign string immediately precedes the currency_symbol. 

4The sign string immediately succeeds the currency_symbol. 

The localeconv_r() function is the reentrant version of localeconv().  The conventions are filled into the structure pointed to by the result parameter.  The buf parameter is used to construct all the members of the structure with type char ∗. 

NOTES

The localeconv() function is not supported for multi-threaded applications.  Instead, its reentrant version, localeconv_r(), should be used with multiple threads. 

Library functions do not call the localeconv() function. 

AES Support Level:
Full use (localeconv())

RETURN VALUES

Upon successful completion, the localeconv() function returns a pointer to the filled-in object.  The structure pointed to by the return value will not be modified by the program, but may be overwritten by a subsequent call to the localeconv() function.  In addition, calls to the setlocale() function with categories LC_ALL, LC_MONETARY or LC_NUMERIC may overwrite the contents of the structure. 

Upon successful completion, the localeconv_r() function returns a value of 0 (zero).  Otherwise, -1 is returned and errno is set to indicate the error. 

ERRORS

If the localeconv_r() function fails, errno may be set to the following value:

[EINVAL]Either the result or buffer parameters are null pointers. 

[ENOMEM]The buffer parameter is too small. 

RELATED INFORMATION

Functions: setlocale(3)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026