C Standard Library 简明教程
C Library - <locale.h>
locale.h 标头定义了位置特定设置,例如日期格式和货币符号。您会发现许多已定义的宏连同一个重要的结构 struct lconv 和两个在下面列出的重要函数。
The locale.h header defines the location specific settings, such as date formats and currency symbols. You will find several macros defined along with an important structure struct lconv and two important functions listed below.
Library Macros
以下是在标头中定义的宏,这些宏将在下面列出的两个函数中使用 −
Following are the macros defined in the header and these macros will be used in two functions listed below −
Sr.No. |
Macro & Description |
1 |
LC_ALL Sets everything. |
2 |
LC_COLLATE Affects strcoll and strxfrm functions. |
3 |
LC_CTYPE Affects all character functions. |
4 |
LC_MONETARY Affects the monetary information provided by localeconv function. |
5 |
LC_NUMERIC Affects decimal-point formatting and the information provided by localeconv function. |
6 |
LC_TIME Affects the strftime function. |
Library Functions
以下在标头 locale.h 中定义了函数 −
Following are the functions defined in the header locale.h −
Sr.No. |
Function & Description |
1 |
char *setlocale(int category, const char *locale)Sets or reads location dependent information. |
2 |
struct lconv *localeconv(void)Sets or reads location dependent information. |