您的位置:首页 > 其它

The basic way to support both ASCII and Unicode:

2008-07-06 17:12 411 查看
By useing #include <tchar.h>, you can support both ASCII and Unicode in your program. The tchar.h header file, defined both way to conduct two kinds of character. Use the macro “_UNICODE” to control if use Unicode.

Use TCHAR to designate a variable, and call the functions such as _tcscpy, _tcschr, _tcscmp, _tcsclen and so on, the operation would switch according to if defined “_UNICODE”.

When there is a letter “T” in the character variable, such as TCHAR, or LPCTSTR, this variety supports both ASCII and Unicode. If _UNICODE is defined, then TCHAR stands for wchar_t, or else the TCHAR stands for char.

Use the L prefix before a character or string constant to designate the wide-character-type constant.

By the way, the wchar_t is the same as unsigned short.

Type Name

Bytes
Other Names
Range of Values
Int
4
signed
–2,147,483,648 to 2,147,483,647
__int8
1
char, signed char
–128 to 127
__int16
2
short, short int, signed short int
–32,768 to 32,767
__int32
4
signed, signed int, int
–2,147,483,648 to 2,147,483,647
__int64
8
long long, signed long long
–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Bool
1
none
false or true
Char
1
none
–128 to 127
Short
2
short int, signed short int
–32,768 to 32,767
Long
4
long int, signed long int
–2,147,483,648 to 2,147,483,647
long long
8
none (but equivalent to __int64)
–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Enum
4
none
Same as int
Float
4
none
3.4E +/- 38 (7 digits)
Double
8
none
1.7E +/- 308 (15 digits)
Long double
same as double
none
same as double
wchar_t
2
__wchar_t
0 to 65,535
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐