Namespaces
Variants
Views
Actions

LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME

From cppreference.com
< cpp‎ | locale
Revision as of 10:18, 22 January 2017 by 160.176.59.6 (Talk)

 
 
 
Defined in header <clocale>
#define LC_ALL      6
#define LC_COLLATE  3
#define LC_CTYPE    0
#define LC_MONETARY 4
#define LC_NUMERIC  1
#define LC_TIME     2

Each of the above macro constants expand to integer constant expressions with distinct values that are suitable for use as the first argument of std::setlocale.

Constant Explanation
LC_ALL selects the entire C locale
LC_COLLATE selects the collation category of the C locale
LC_CTYPE selects the character classification category of the C locale
LC_MONETARY selects the monetary formatting category of the C locale
LC_NUMERIC selects the numeric formatting category of the C locale
LC_TIME selects the time formatting category of the C locale

Additional macro constants, with names that begin with LC_ followed by at least one uppercase letter, may be defined in <clocale>. For example, the POSIX specification requires LC_MESSAGES (which controls std::perror and std::strerror) and the GNU C library additionally defines LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT, and LC_IDENTIFICATION.

Example

#include <stdio.h>
#include <locale.h>
 
int main()
{
    return printf("%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n", 
                  LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_MESSAGES, LC_PAPER, LC_NAME,
                  LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT,  LC_IDENTIFICATION, LC_NUMERIC,
                  LC_TIME);
}

See also

gets and sets the current C locale
(function) [edit]
set of polymorphic facets that encapsulate cultural differences
(class) [edit]
C documentation for locale categories