To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

4,5
Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
Live Statistics
English Articles
Improved in 24 Hours
Added in 24 Hours
Languages
Recent
Show all languages
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.
.
Leo
Newton
Brights
Milds

C localization functions

From Wikipedia, the free encyclopedia

In computing, C localization functions are a group of functions in the C programming language implementing basic localization routines.[1][2] 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 input/output functions in the C Standard Library.[3]

YouTube Encyclopedic

  • 1/3
    Views:
    14 509
    31 379
    1 474 025
  • 26: Programming in the Large - Richard Buckland UNSW
  • Lecture 11 | Detection and Segmentation
  • The Problem with Time & Timezones - Computerphile

Transcription

Overview of functions

C localization functions and types are defined in locale.h (clocale header in C++).[4][5]

Function Description
setlocale sets and gets the current C locale
localeconv returns numeric and monetary formatting details of the current locale

Criticism

C standard localization functions are criticized because the localization state is stored globally. This means that in a given program all operations involving a locale can use only one locale at a time. As a result, it is very difficult to implement programs that use more than one locale.[6]

The functions alter the behavior of printf/scanf/strtod which are often used to write saved data to a file or to other programs. The result is that a saved file in one locale will not be readable in another locale, or not be readable at all due to assumptions such as "numbers end at comma characters". Most large-scale software forces the locale to "C" (or another fixed value) to work around these problems.

Example

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

int main(void)
{
    /* Locale is set to "C" before this. This call sets it
       to the "current locale" by reading environment variables: */
    setlocale(LC_ALL, "");

    const struct lconv * const currentlocale = localeconv();

    printf("In the current locale, the default currency symbol is: %s\n",
        currentlocale->currency_symbol);

    return EXIT_SUCCESS;
}

See also

References

  1. ^ ISO/IEC 9899:1999 specification (PDF). p. 204, § 7.11 Localization.
  2. ^ Prata, Stephen (2004). C primer plus. Sams Publishing. Appendix B, Section V: The Standard ANSI C Library with C99 Additions. ISBN 0-672-32696-5.
  3. ^ "ISO/IEC 9899:201x" (PDF). 12 April 2011. p. 181. Archived from the original (PDF) on 29 March 2018.
  4. ^ "locale.h". utas.edu.au. infosys. Archived from the original on 4 June 2012. Retrieved 14 September 2011.
  5. ^ "openbsd/src". GitHub. Retrieved 9 April 2018.
  6. ^ "The Standard C Locale and the Standard C++ Locales". Rogue Wave Software, Inc. 1996. Archived from the original on 19 February 2020. Retrieved 10 November 2011.
This page was last edited on 7 November 2023, at 08:28
Basis of this page is in Wikipedia. Text is available under the CC BY-SA 3.0 Unported License. Non-text media are available under their specified licenses. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. WIKI 2 is an independent company and has no affiliation with Wikimedia Foundation.