Standards / Extensions | C or C++ | Dependencies |
---|---|---|
ISO C Amendment |
both |
#include <wchar.h>
int wctob(wint_t c);
#define _XOPEN_SOURCE
#define _MSE_PROTOS
#include <wchar.h>
int wctob(wint_t c);
Determines whether c corresponds to a member of the extended character set whose multibyte character corresponds to a single byte when in initial shift state.
The behavior of this wide-character function is affected by the LC_CTYPE category of the current locale. If you change the category, undefined results can occur.
Special behavior for XPG4: If you define any feature test macro specifying XPG4 behavior before the statement in your program source file to include the wchar header, then you must also define the _MSE_PROTOS feature test macro to make the declaration of the wctob() function in the wchar header available when you compile your program. Please see Table 1 for a list of XPG4 and other feature test macros.
If successful, wctob() returns the single-byte representation.
If c does not correspond to a multibyte character with length one, wctob() returns EOF.
⁄* CELEBW29 *⁄
#include <stdio.h>
#include <wchar.h>
int main(void)
{
wint_t wc = L'A';
if (wctob(wc) == wc)
printf("wc is a valid single byte character\n");
else
printf("wc is not a valid single byte character\n");
}
wc is a valid single-byte character