LOCALECONV(3POSIX)
๐ LOCALECONV(3POSIX) โ the POSIX Programmer's Manual, but make it cute ๐
okay bestie, so this is the localeconv page from the POSIX Programmer's Manual (that's the 3POSIX situation), and it's a whole journey. grab a snack. ๐
๐ธ PROLOG ๐ธ
so like, real talk first โ this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ (so pls consult the corresponding Linux manual page for the deets on Linux behavior), or honestly the interface may not be implemented on Linux at all. no cap. ๐
โจ NAME โจ
localeconv โ return locale-specific information
๐ SYNOPSIS ๐
#include <locale.h>
struct lconv *localeconv(void);
๐ DESCRIPTION ๐
okay so the functionality described on this reference page is aligned with the ISO C standard. and like, any conflict between the requirements described here and the ISO C standard is unintentional โ this volume of POSIX.1โ2017 defers to the ISO C standard. periodt. ๐
The localeconv() function shall set the components of an object with the type struct lconv with the values appropriate for the formatting of numeric quantities (monetary and otherwise) according to the rules of the current locale. it's giving "tell me everything about how this locale does numbers." โจ
The members of the structure with type char * are pointers to strings, any of which (except decimal_point) can point to "", to indicate that the value is not available in the current locale or is of zero length. meanwhile the members with type char are non-negative 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 radix character used to format non-monetary quantities.char *thousands_sepโ the character used to separate groups of digits before the decimal-point character in formatted non-monetary quantities.char *groupingโ a string whose elements, taken as one-byte integer values, indicate the size of each group of digits in formatted non-monetary quantities.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 the ISO 4217:2001 standard. the fourth character (immediately preceding the null byte) 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 radix character used to format monetary quantities.char *mon_thousands_sepโ the separator for groups of digits before the decimal-point in formatted monetary quantities.char *mon_groupingโ a string whose elements, taken as one-byte integer values, indicate the size of each group of digits in formatted monetary quantities.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 after the decimal-point) to be displayed in an internationally formatted monetary quantity.char frac_digitsโ the number of fractional digits (those after the decimal-point) to be displayed in a formatted monetary quantity.char p_cs_precedesโ set to1if thecurrency_symbolprecedes the value for a non-negative formatted monetary quantity. set to0if the symbol succeeds the value.char p_sep_by_spaceโ set to a value indicating the separation of thecurrency_symbol, the sign string, and the value for a non-negative formatted monetary quantity.char n_cs_precedesโ set to1if thecurrency_symbolprecedes the value for a negative formatted monetary quantity. set to0if the symbol succeeds the value.char n_sep_by_spaceโ set to a value indicating the separation of thecurrency_symbol, the sign string, and the value for a negative formatted monetary quantity.char p_sign_posnโ set to a value indicating the positioning of thepositive_signfor a non-negative formatted monetary quantity.char n_sign_posnโ set to a value indicating the positioning of thenegative_signfor a negative formatted monetary quantity.char int_p_cs_precedesโ set to1or0if theint_curr_symbolrespectively precedes or succeeds the value for a non-negative internationally formatted monetary quantity.char int_n_cs_precedesโ set to1or0if theint_curr_symbolrespectively precedes or succeeds the value for a negative internationally formatted monetary quantity.char int_p_sep_by_spaceโ set to a value indicating the separation of theint_curr_symbol, the sign string, and the value for a non-negative internationally formatted monetary quantity.char int_n_sep_by_spaceโ set to a value indicating the separation of theint_curr_symbol, the sign string, and the value for a negative internationally formatted monetary quantity.char int_p_sign_posnโ set to a value indicating the positioning of thepositive_signfor a non-negative internationally formatted monetary quantity.char int_n_sign_posnโ set to a value indicating the positioning of thenegative_signfor a negative internationally formatted monetary quantity.
The elements of grouping and mon_grouping are interpreted according to the following:
{CHAR_MAX}โ no further grouping is to be performed.0โ the previous element is to be repeatedly used for the remainder of the digits.- other โ the integer 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 before the current group.
The values of p_sep_by_space, n_sep_by_space, int_p_sep_by_space, and int_n_sep_by_space are interpreted according to the following:
0โ no space separates the currency symbol and value.1โ if the currency symbol and sign string are adjacent, a space separates them from the value; otherwise, a space separates the currency symbol from the value.2โ if the currency symbol and sign string are adjacent, a space separates them; otherwise, a space separates the sign string from the value.
For int_p_sep_by_space and int_n_sep_by_space, the fourth character of int_curr_symbol is used instead of a space. ๐ซ
The values of p_sign_posn, n_sign_posn, int_p_sign_posn, and int_n_sign_posn are interpreted according to the following:
0โ parentheses surround the quantity andcurrency_symbolorint_curr_symbol.1โ the sign string precedes the quantity andcurrency_symbolorint_curr_symbol.2โ the sign string succeeds the quantity andcurrency_symbolorint_curr_symbol.3โ the sign string immediately precedes thecurrency_symbolorint_curr_symbol.4โ the sign string immediately succeeds thecurrency_symbolorint_curr_symbol.
The implementation shall behave as if no function in this volume of POSIX.1โ2017 calls localeconv(). ๐ง
The localeconv() function need not be thread-safe. (yeah. she's not built for the group chat, she's built for one conversation at a time. ๐ญ)
๐ฆ RETURN VALUE ๐ฆ
The localeconv() function shall return a pointer to the filled-in object.
โ ๏ธ bestie listen. The application shall not modify the structure to which the return value points, nor any storage areas pointed to by pointers within the structure.
The returned pointer, and pointers within the structure, might be invalidated, or the structure or the storage areas might be overwritten, by a subsequent call to localeconv().
In addition, the returned pointer, and pointers within the structure, might be invalidated or the structure or the storage areas might be overwritten by subsequent calls to setlocale() with the categories LC_ALL, LC_MONETARY, or LC_NUMERIC, or by calls to uselocale() which change the categories LC_MONETARY or LC_NUMERIC.
The returned pointer, pointers within the structure, the structure, and the storage areas might also be invalidated if the calling thread is terminated. ๐
๐ ERRORS ๐
No errors are defined. (iconic behavior honestly, she simply does not fail)
The following sections are informative. ๐
๐ EXAMPLES ๐
None.
โจ APPLICATION USAGE โจ
Okay bestie, gather round. This next bit is showing you how four countries might format their money, and it's giving major locale energy. ๐ธโจ
- Italy โ Positive Format:
โฌ.1.230; Negative Format:-โฌ.1.230; International Format:EUR.1.230 - Netherlands โ Positive Format:
โฌ 1.234,56; Negative Format:โฌ -1.234,56; International Format:EUR 1.234,56 - Norway โ Positive Format:
kr1.234,56; Negative Format:kr1.234,56-; International Format:NOK 1.234,56 - Switzerland โ Positive Format:
SFrs.1,234.56; Negative Format:SFrs.1,234.56C; International Format:CHF 1,234.56
For these four countries, the values for the monetary members of the structure returned by localeconv() are literally:
int_curr_symbolโ Italy:"EUR."; Netherlands:"EUR "; Norway:"NOK "; Switzerland:"CHF "currency_symbolโ Italy:"โฌ."; Netherlands:"โฌ"; Norway:"kr"; Switzerland:"SFrs."mon_decimal_pointโ Italy:""; Netherlands:","; Norway:","; Switzerland:"."mon_thousands_sepโ Italy:"."; Netherlands:"."; Norway:"."; Switzerland:","mon_groupingโ Italy:"\3"; Netherlands:"\3"; Norway:"\3"; Switzerland:"\3"positive_signโ Italy:""; Netherlands:""; Norway:""; Switzerland:""negative_signโ Italy:"-"; Netherlands:"-"; Norway:"-"; Switzerland:"C"int_frac_digitsโ Italy:0; Netherlands:2; Norway:2; Switzerland:2frac_digitsโ Italy:0; Netherlands:2; Norway:2; Switzerland:2p_cs_precedesโ Italy:1; Netherlands:1; Norway:1; Switzerland:1p_sep_by_spaceโ Italy:0; Netherlands:1; Norway:0; Switzerland:0n_cs_precedesโ Italy:1; Netherlands:1; Norway:1; Switzerland:1n_sep_by_spaceโ Italy:0; Netherlands:1; Norway:0; Switzerland:0p_sign_posnโ Italy:1; Netherlands:1; Norway:1; Switzerland:1n_sign_posnโ Italy:1; Netherlands:4; Norway:2; Switzerland:2int_p_cs_precedesโ Italy:1; Netherlands:1; Norway:1; Switzerland:1int_n_cs_precedesโ Italy:1; Netherlands:1; Norway:1; Switzerland:1int_p_sep_by_spaceโ Italy:0; Netherlands:0; Norway:0; Switzerland:0int_n_sep_by_spaceโ Italy:0; Netherlands:0; Norway:0; Switzerland:0int_p_sign_posnโ Italy:1; Netherlands:1; Norway:1; Switzerland:1int_n_sign_posnโ Italy:1; Netherlands:4; Norway:4; Switzerland:2
๐ฆ RATIONALE ๐ฆ
None. That's it. No crumbs. ๐
๐ฎ FUTURE DIRECTIONS ๐ฎ
None. No future plans, bestie. Periodt. ๐
๐ SEE ALSO ๐
Go check these out, iykyk:
fprintf()fscanf()isalpha()isascii()nl_langinfo()setlocale()strcat()strchr()strcmp()strcoll()strcpy()strftime()strlen()strpbrk()strspn()strtok()strxfrm()strtod()uselocale()
The Base Definitions volume of POSIX.1โ2017, <langinfo.h>, <locale.h>
๐ COPYRIGHT ๐
Okay legal tea, bestie, but we're keeping it 100% exact. No edits, no cap.
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
And that's the whole vibe, bestie. This page comes from IEEE/The Open Group, dated 2017, and it's literally LOCALECONV(3POSIX). Stay iconic, slay the locale game, and remember: format your money responsibly. ๐โจ
๐ฆ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 ยท Other
- debian trixie: manpages-posix-dev 2017a-2 ยท Other
- ubuntu jammy: manpages-posix-dev 2017a-2 ยท Other
- ubuntu noble: manpages-posix-dev 2017a-2 ยท Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 ยท Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 ยท Other
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms