Home

cwchar

cwchar is a C++ standard library header that provides facilities for handling wide characters, mirroring the C header wchar.h. It declares types, constants, and a set of functions for processing wchar_t strings and for converting between wide-character and multibyte representations. In typical C++ usage, these facilities are provided in the std namespace, while some implementations expose them in the global namespace as well.

Core types include wchar_t, used to represent individual wide characters; mbstate_t, which records the conversion state

Function families include wide-string operations (such as wcslen, wcscpy, wcscat, and wcscmp) for manipulating wide-character sequences;

Usage notes: include <cwchar> and refer to names in std:: (e.g., std::wcslen). The C and C++ standards

See also: wchar.h, cwctype, and wide-character I/O.

for
multibyte-to-wide
and
wide-to-multibyte
transitions;
and
the
macro
WEOF,
used
to
indicate
end-of-file
in
wide
streams.
cwchar
forms
part
of
the
bridge
between
C
and
C++
wide-character
support.
and
conversion
routines
(such
as
wcstombs,
mbstowcs,
wcsrtombs,
and
mbsrtowcs)
for
translating
between
wide
strings
and
multibyte
sequences.
The
header
also
provides
wide
I/O
facilities
such
as
fwprintf,
fgetwc,
fputwc,
and
their
variants
when
used
with
wide
streams.
ensure
compatibility
with
the
corresponding
C
library;
it
is
common
to
use
cwchar
alongside
<cwctype>
for
classification
and
transformation
of
wide
characters.