wctob -- Convert Wide Character to Byte

Format

#include <stdio.h>
#include <wchar.h>
int wctob(wint_t wc);

Language Level: ANSI 93
wctob determines whether wc corresponds to a member of the extended character set, whose multibyte character has a length of 1 byte.

The behavior of wctob is affected by the LC_CTYPE category of the current locale.

Return Value
If c corresponds to a multibyte character with a length of 1 byte, wctob returns the single-byte representation. Otherwise, wctob returns EOF.

Example
This example uses wctob to test if the wide character A is a valid single-byte character.

#include <stdio.h>
#include <wchar.h>
int main(void)
{
   wint_t wc = L'A';
   if (wctob(wc) == wc)
      printf("%lc is a valid single byte character\n", wc);
   else
      printf("%lc is not a valid single byte character\n", wc);
   return 0;
   /************************************************************
      The output should be similar to:
      A is a valid single byte character
   ************************************************************/
}



mbtowc -- Convert Multibyte Character to Wide Character
wctomb -- Convert Wide Character to Multibyte Character
wcstombs -- Convert Wide-Character String to Multibyte String
<wchar.h>