Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <locale.h>
    char *setlocale( int category, const char *locale );
    wchar_t *_wsetlocale( int category, const wchar_t *locale);

Description:
    The setlocale function selects a portion of a program's locale according
    to the category given by category and the locale specified by locale.  A
    locale affects the collating sequence (the order in which characters
    compare with one another), the way in which certain character-handling
    functions operate, the decimal-point character that is used in formatted
    input/output and string conversion, and the format and names used in the
    time string produced by the  strftime function.

    Potentially, there may be many such environments.  Watcom C/C++ supports
    only the "C" locale and so invoking this function will have no effect
    upon the behavior of a program at present.

    The possible values for the argument category are as follows:

    Category     Meaning

LC_ALL
    select entire environment

LC_COLLATE
    select collating sequence

LC_CTYPE
    select the character-handling

LC_MONETARY
    select monetary formatting information

LC_NUMERIC
    select the numeric-format environment

LC_TIME
    select the time-related environment

    At the start of a program, the equivalent of the following statement is
    executed.

        setlocale( LC_ALL, "C" );
    The _wsetlocale function is a wide-character version of setlocale that
    operates with wide-character strings.

Returns:
    If the selection is successful, a string is returned to indicate the
    locale that was in effect before the function was invoked; otherwise, a
    NULL pointer is returned.

Example:
    #include <stdio.h>
    #include <string.h>
    #include <locale.h>

    char src[] = { "A sample STRING" };
    char dst[20];

    void main()
      {
        char *prev_locale;
        size_t len;

        /* set native locale */
        prev_locale = setlocale( LC_ALL, "" );
        printf( "%s\n", prev_locale );
        len = strxfrm( dst, src, 20 );
        printf( "%s (%u)\n", dst, len );
      }

    produces the following:

    C
    A sample STRING (15)

Classification:
    setlocale is ANSI, POSIX 1003.1, _wsetlocale is not ANSI

Systems:
     setlocale - All, Netware

    _wsetlocale - All

See Also:
    strcoll, strftime, strxfrm

See Also:

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson