放大啦资源网 http://www.fangdala.com
当前位置首页 > 百科资料> 正文

Setlocale

2023-02-01 19:13:53 暂无评论 百科资料

Setlocale是一个计算机函数,功能是用来配置地域的信息,设置当前程序使用的本地化信息。若 locale 为零(NU征团角理左钟既艺础LL),则不会改变地域化配置,返回当前的地域值,若系统尚未实作则返回 false。

  • 外文名称 Setlocale
  • 函数种类 操作系统与环境
  • 类型 数据
  • 领域 程序

梗概来自:

  配置地域化信息函数

  #include <locale.h>

  char *setlocale (int category, const char * locale);

描述:

  函数种类: 操作系统与环境

  内容说明:

  本函数用来配置地域的信息,设置当前程序使用的本地化信息。参数 cat360百科egory 有下列的选择:

  LC_ALL 包括下面的全部选项都要。 LC_COLLATE 配置字符串比较,PHP 尚未实作出来本项。 LC_CTYPE 配置字符类别及转换。例如全变大写 strtoupper()。 LC_MONETARY 配置金融货币,PHP 尚未实作。 LC_NUM坐宁决少ERIC 配置小数点后法记致的位数。 LC_TI承比烟酒提演态续无ME 配置时间日期格式,与 strftime() 合用。 而参数 胶随locale 若是空字符串 "",则会使用系统环境变量的 locale 。若 locale 为零(NULL),则不会改变地域化配置,返回当前的地域值,若系统尚未实作则返回 false。

  Locales contain information on how to interpret and pe条后酒酸过运剂倍rform certain 过它实双最可input/output and transformation operations taking into consideration location and language specific settings.

  Most running environments have certain locale information set according to the user preferences or localization. But, independently of this system locale, on start, all C programs have the "C" locale set, which is a rather neutral locale with minimal locale inf味何ormation that allows the result of programs to be predictable. In order to use the default locale 假迫华至九控和整磁弦士set in the environment, this f酒所换华特普兰unction can be called with "" as the localeparameter.

  The locale set on start is the same as setlocale(LC_ALL,"C") would set.

  The entire default locale can be set by calling setlocale(LC_ALL,"");

  C程序开始的时候的设置和 setlocale(LC_ALL,"C")相同

  使用系统默认的设置调用setlocale(LC_ALL,"");

  The parts of the current locale affected by a call to this function are specified by parameter category.

  若想显示中文"我爱你",则要包含#include <locale.h> 加一下代码:

  wchar_t s[]={ 25105, 29233 ,20320 ,0};

  setlocale( LC_ALL, "" );

  printf("%ls",s);//注意是ls

返回值

  成功:返回相应设置的地来自域化信息。字符串可能分配在静态存储区。

  失败:返回N360百科ULL

猜你喜欢