char
: 8-bit character (underlying C/C++ data type)CHAR
: alias of char
(Windows data type)LPSTR
: null-terminated string of CHAR
(Long Pointer)LPCSTR
: constant null-terminated string of CHAR
(Long Pointer Constant)wchar_t
: 16-bit character (underlying C/C++ data type)WCHAR
: alias of wchar_t
(Windows data type)LPWSTR
: null-terminated string of WCHAR
(Long Pointer)LPCWSTR
: constant null-terminated string of WCHAR
(Long Pointer Constant)UNICODE
defineTCHAR
: alias of WCHAR
if UNICODE is defined; otherwise CHAR
LPTSTR
: null-terminated string of TCHAR
(Long Pointer)LPCTSTR
: constant null-terminated string of TCHAR
(Long Pointer Constant)So:
Item | 8-bit (Ansi) | 16-bit (Wide) | Varies |
---|---|---|---|
character | CHAR |
WCHAR |
TCHAR |
string | LPSTR |
LPWSTR |
LPTSTR |
string (const) | LPCSTR |
LPCWSTR |
LPCTSTR |
TCHAR
? Text Char (archive.is)
Why is the default 8-bit codepage called "ANSI"?
From Unicode and Windows XP
by Cathy Wissink
Program Manager, Windows Globalization
Microsoft Corporation
May 2002
Despite the underlying Unicode support on Windows NT 3.1, code page support continued to be necessary for many of the higher-level applications and components included in the system, explaining the pervasive use of the “A” [ANSI] versions of the Win32 APIs rather than the “W” [“wide” or Unicode] versions. (The term “ANSI” as used to signify Windows code pages is a historical reference, but is nowadays a misnomer that continues to persist in the Windows community. The source of this comes from the fact that the Windows code page 1252 was originally based on an ANSI draft, which became ISO Standard 8859-1. However, in adding code points to the range reserved for control codes in the ISO standard, the Windows code page 1252 and subsequent Windows code pages originally based on the ISO 8859-x series deviated from ISO. To this day, it is not uncommon to have the development community, both within and outside of Microsoft, confuse the 8859-1 code page with Windows 1252, as well as see “ANSI” or “A” used to signify Windows code page support.)