Content deleted Content added
Tags: Reverted Visual edit |
Undid revision 1079860791 by 212.90.42.201 (talk) |
||
Line 1:
{{Use dmy dates|date=December 2020}}
{{C Standard Library}}
In [[computing]], '''C localization functions''' are a group of functions in the [[C (programming language)|C programming language]] implementing basic localization routines.<ref name="c99">{{cite book | url=http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf | title=ISO/IEC 9899:1999 specification | at=p. 204, § 7.11 ''Localization'' }}</ref><ref name="c_primer">{{cite book|title=C primer plus | first=Stephen | last=Prata | year=2004 | publisher=Sams Publishing | isbn=0-672-32696-5 | at=Appendix B, Section V: The Standard ANSI C Library with C99 Additions}}</ref> The functions are used in multilingual programs to adapt to the specific locale. In particular, the way of displaying of numbers and currency can be modified. These settings affect the behaviour of [[C file input/output|input/output functions]] in the C Standard Library.<ref>{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf|title=ISO/IEC 9899:201x|date=12 April 2011|page=181|archive-url=https://web.archive.org/web/20180329042731/http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf|archive-date=29 March 2018|url-status=}}</ref>
==Overview of functions==
C localization functions and types are defined in {{mono|locale.h}} ({{mono|clocale}} header in C++).<ref name=www.utas.edu.au>{{cite web|title=locale.h|url=http://www.utas.edu.au/infosys/info/documentation/C/CStdLib.html#locale.h|work=utas.edu.au|publisher=infosys|accessdate=14 September 2011}}</ref><ref>{{Cite web|url=https://github.com/openbsd/src/blob/master/include/locale.h|title=openbsd/src|website=GitHub|language=en|access-date=2018-04-09}}</ref>
{| class="wikitable" style="font-size:0.85em;"
! Function
! Description
|-
! style="font-family:monospace" | {{anchor|setlocale}}[http://en.cppreference.com/w/c/locale/setlocale setlocale]
| sets and gets the current C locale
|-
! style="font-family:monospace" | {{anchor|localeconv}}[http://en.cppreference.com/w/c/locale/localeconv localeconv]
| returns numeric and monetary formatting details of the current locale
|-
|}
==Criticism==
Line 18 ⟶ 27:
==Example==
<syntaxhighlight
#include <stdio.h>
#include <stdlib.h>
Line 36 ⟶ 45:
return EXIT_SUCCESS;
}
</syntaxhighlight
==See also==
*[[Locale (computer software)]]
|