Obtains the single-byte equivalent of a wide character, if any #include <stdio.h> #include <wchar.h> int wctob ( wint_t wc ); The wctob( ) function returns the single-byte member of the extended character set, if there is one, that corresponds to its wide character argument, wc. To be more exact, wctob( ) determines whether there is a character in the extended character set which corresponds to the wide character wc, and whose multibyte character representation is expressed in a single byte in the initial shift state of the locale's multibyte encoding. If this is the case, then wctob( ) returns that character, converted from unsigned char to int. If not, wctob( ) returns EOF. ExampleFILE *fp_inwide; wchar_t wc; int bc; /* ... open the files ... */ fwide( fp_inwide, 1 ); while (( wc = fgetwc( fp_inwide )) != WEOF ) if (( bc = wctob( wc )) != EOF ) fputc( c, stdout ); else // If no byte-character equivalent, fputc( '?', stdout ); // print a question mark instead. See Alsowctomb( ), wcrtomb( ), wcstombs( ), and wcsrtombs( ); btowc( ), mbtowc( ), mbrtowc( ), mbstowcs( ), and mbsrtowcs( ) |