⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 locale.c

📁 标准c库代码,可以应用于各个系统提供了大量的基本函数
💻 C
字号:
/*FUNCTION<<setlocale>>, <<localeconv>>---select or query localeINDEX	setlocaleINDEX	localeconvINDEX	_setlocale_rINDEX	_localeconv_rANSI_SYNOPSIS	#include <locale.h>	char *setlocale(int <[category]>, const char *<[locale]>);	lconv *localeconv(void);	char *_setlocale_r(void *<[reent]>,                        int <[category]>, const char *<[locale]>);	lconv *_localeconv_r(void *<[reent]>);TRAD_SYNOPSIS	#include <locale.h>	char *setlocale(<[category]>, <[locale]>)	int <[category]>;	char *<[locale]>;	lconv *localeconv();	char *_setlocale_r(<[reent]>, <[category]>, <[locale]>)	char *<[reent]>;	int <[category]>;	char *<[locale]>;	lconv *_localeconv_r(<[reent]>);	char *<[reent]>;DESCRIPTION<<setlocale>> is the facility defined by ANSI C to condition theexecution environment for international collating and formattinginformation; <<localeconv>> reports on the settings of the currentlocale.This is a minimal implementation, supporting only the required <<``C''>>value for <[locale]>; strings representing other locales are nothonored.  (<<``''>> is also accepted; it represents the default localefor an implementation, here equivalent to <<``C''>>.)If you use <<NULL>> as the <[locale]> argument, <<setlocale>> returnsa pointer to the string representing the current locale (always<<``C''>> in this implementation).  The acceptable values for<[category]> are defined in `<<locale.h>>' as macros beginning with<<"LC_">>, but this implementation does not check the values you passin the <[category]> argument.<<localeconv>> returns a pointer to a structure (also defined in`<<locale.h>>') describing the locale-specific conventions currentlyin effect.  <<_localeconv_r>> and <<_setlocale_r>> are reentrant versions of<<localeconv>> and <<setlocale>> respectively.  The extra argument<[reent]> is a pointer to a reentrancy structure.RETURNS<<setlocale>> returns either a pointer to a string naming the localecurrently in effect (always <<``C''>> for this implementation), or, ifthe locale request cannot be honored, <<NULL>>.<<localeconv>> returns a pointer to a structure of type <<lconv>>,which describes the formatting and collating conventions in effect (inthis implementation, always those of the C locale).PORTABILITYANSI C requires <<setlocale>>, but the only locale required across allimplementations is the C locale.No supporting OS subroutines are required.*//* * setlocale, localeconv : internationalize your locale. *                         (Only "C" or null supported). */#include <locale.h>#include <string.h>#include <limits.h>#include <reent.h>static _CONST struct lconv lconv = {  ".", "", "", "", "", "", "", "", "", "",  CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX,  CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX,};char *_DEFUN(_setlocale_r, (p, category, locale),       struct _reent *p _AND       int category _AND       _CONST char *locale){  if (locale && strcmp (locale, "C") && strcmp (locale, ""))   return 0;  p->_current_category = category;    p->_current_locale = locale;    return "C";}struct lconv *_DEFUN(_localeconv_r, (data),       struct _reent *data){  return (struct lconv *) &lconv;}#ifndef _REENT_ONLYchar *_DEFUN(setlocale, (category, locale),       int category _AND       _CONST char *locale){  return _setlocale_r (_REENT, category, locale);}struct lconv *_DEFUN_VOID(localeconv){  return _localeconv_r (_REENT);}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -