Jump to content

C++ Language/Std/Strings/Unicode

From Wikibooks, open books for an open world

This is the current revision of this page, as edited by SoftwareEngineerMoose (discuss | contribs) at 06:40, 23 February 2022 (Created page with "{{C++ Language}} An 8-bit "Ascii character" has type <code>char</code> (its literal values are <code>char cVar = 'h';</code> and <code>"hello"</code>, its Standard Library functions are named like <code>strlen()</code>, and its Win32 functions are named like <code>SetWindowTextA()</code>). A "wide-Unicode character" has type <code>wchar_t</code> (its literal values are <code>wchar_t cwVar = L'h';</code> and <code>L"hello"</code>, its Stand..."). The present address (URL) is a permanent link to this version.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

An 8-bit "Ascii character" has type char (its literal values are char cVar = 'h'; and "hello", its Standard Library functions are named like strlen(), and its Win32 functions are named like SetWindowTextA()).

A "wide-Unicode character" has type wchar_t (its literal values are wchar_t cwVar = L'h'; and L"hello", its Standard Library functions are named liked wcslen(), and its Win32 functions are named like SetWindowTextW()).

Windows programmers use preprocessor macros in TCHAR cxVar = _TEXT('h'); to alias either char cxVar = 'h'; or wchar_t cxVar = L'h'; (these macros are controlled by Windows' build system). That same switching mechanism also controls the expansion of macros _tcslen() and SetWindowText().

Additional information about Unicode