C examples for wchar.h:btowc
function
<cwchar> <wchar.h>
Convert single byte character to wide character
wint_t btowc (int c);
Parameter | Description |
---|---|
c | The int promotion of a byte. |
On success, function the parameter as a wchar_t.
If c is EOF, or if c is not a valid single-byte representation, the function returns WEOF.
#include <wchar.h> int main()/*w w w .java 2 s. c om*/ { int i,num; const char mbs [] = "btowc example"; num=0; for (i=0; i<sizeof(mbs); ++i) if (btowc(mbs[i]) != WEOF) ++num; wprintf (L"mbs contains %d single-byte characters.\n",num); return 0; }