Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* setlocale example */
#include <stdio.h> /* printf */
#include <time.h> /* time_t, struct tm, time, localtime, strftime */
#include <locale.h> /* struct lconv, setlocale, localeconv */ int main ()
{
time_t rawtime;
struct tm * timeinfo;
char buffer [80]; struct lconv * lc; time ( &rawtime );
timeinfo = localtime ( &rawtime ); int twice=0; do {
printf ("Locale is: %s\n", setlocale(LC_ALL,NULL) ); strftime (buffer,80,"%c",timeinfo);
printf ("Date is: %s\n",buffer); lc = localeconv ();
printf ("Currency symbol is: %s\n-\n",lc->currency_symbol); setlocale (LC_ALL,"");
} while (!twice++); return 0;
}

One of the possible outputs when the previous code is run is:

Locale is: C
Date is: 01/15/07 13:33:47
Currency symbol is:
-
Locale is: English_United States.1252
Date is: 1/15/07 1:33:47 PM
Currency symbol is: $
-

http://www.cplusplus.com/reference/clocale/setlocale/

最新文章

  1. ASP.NET Aries DataGrid 配置表头说明文档
  2. Log4net入门(回滚日志文件篇)
  3. 如何通过倾斜摄影数据手动配置s3c索引文件?
  4. unix基本命令日记
  5. Thread锁 Monitor类、Lock关键字和Mutex类
  6. 深入理解Java内存模型(四)——volatile
  7. Best Cow Line (POJ 3217)
  8. HDU 题目分类收集
  9. 深入理解Java虚拟机:OutOfMemory实战
  10. Spring 框架理论基础
  11. Gate One
  12. 一个基于JRTPLIB的轻量级RTSP客户端——myRTSPClient详解
  13. 第二周c语言PTA作业留
  14. delphi 验证码识别(XE8源码)
  15. 一个你不能错过的第三方.net集合库
  16. Libgdx slg游戏进程记录
  17. C++_调用约束
  18. 使用Golang打造自己的http服务器 1.0版本
  19. 为 github markdown 文件生成目录(toc)
  20. 微信小程序之---- 数据处理

热门文章

  1. java基本数据类型练习
  2. 一起学Python:网络通信过程
  3. 利用WPF建立自己的3d gis软件(非axhost方式)(二)基础状态切换
  4. express笔记
  5. Node.js学习疑惑整理
  6. linux 命令学习 —— 硬件外设管理(dmesg、lsusb)
  7. LeetCode: Generate Parentheses [021]
  8. iis启动&#160;服务无法在此时接受控制信息。&#160;(异常来自&#160;HRESULT:0x80070425)
  9. c语言学习笔记(12)——补码
  10. 在动态THML语句中调用JS函数传递带空格参数的问题