ANSI vs UNICODE
来源:互联网 发布:java系统业务日志设计 编辑:程序博客网 时间:2024/04/30 13:57
环境:C RunTime Library
Unicode 在ANSI C中的定义:
String.h
typedef unsigned short wchar_t
标准的ANSI C字符串函数及等价Unicode函数
char * strchr(const char *, int);
wchar_t * wcschr(const wchar *, wchar_t);
int strcmp(const char *, const char *);
int wcscmp(const wchar_t *, const wchar_t *);
char * strcpy(char *, const char *);
wchar_t * wcscpy(wchar_t *, const wchar_t *);
size_t strlen(const char *);
size_t wcslen(const wchar_t *);
所有的Unicode函数均以wcs开头,wcs是宽字符串的英文缩写。若要调用Unicode函数,只要用前缀wcs来取代ANSI字符串函数的前缀str即可。
创建ANSI/Unicode通用代码必须包含TChar.h文件而不是String.h文件。它包含了一组宏用以避免直接调用str函数或wcs函数。由是否定义_UNICODE控制选择。拥有字符串参数的所有C运行期函数都在TChar.h文件中定义了一个通用宏。使用TCHAR与_TEXT宏,定义字符串数组。
char *szTesst = “This is a ANSI string!”
wchar_t *szTest = L“This is a Unicode string!”;
TCHAR *szTest = _TEXT“This is a ANSI/Unicode string!”;
wistream wcin Reads wide-character input from the standard input channel
wostream wcout Writes "normal" wide-character output to the standard output channel
wostream wcerr Writes wide-character error messages to the standard error channel
wostream wclog Writes wide-character log messages to the standard logging channel
[参考文献]
Jeffrey Richter -- Programming Applications for Microsoft Windows, Fourth Edition
Nicolai M. Josuttis -- C++ Standard Library, The: A Tutorial and Reference
- Unicode vs Ansi
- Unicode vs Ansi
- ANSI vs UNICODE
- Unicode vs Ansi
- Unicode vs Ansi
- vs 2005 Unicode 转 ANSI
- VB编程中的Unicode vs Ansi
- VB编程中的Unicode vs Ansi
- 《Windows核心编程》之”Unicode vs ANSI“
- ANSI ---> UNICODE
- ANSI,UNICODE
- VS中遇到的 UNICODE和ANSI 编码问题
- UNICODE to ANSI 和 ANSI to UNICODE
- Ansi转Unicode,Unicode转Ansi
- ANSI,MBCS,UNICODE
- ANSI与UNICODE
- UNICODE 和 ANSI 互转
- unicode,ansi编码转换
- Java中float的取值范围
- Bugzilla简明使用手则
- C delphi python
- 听说delphi9要出来了
- base64编码
- ANSI vs UNICODE
- 超越车田正美
- Spring
- Introducing to Spring Framework
- 7个软件开发原则
- 高级 DAO 编程
- Struts环境配置手记(eclipse版)
- “Web标准?你需要吗?”之我见
- 控制骰子的大小