Programming Reference/Librarys
Question & Answer
Q&A is closed
convert a byte to wide character btowc returns the wide two byte character “wchar_t” converted from the single byte “string” character (char).
If the argument is not a valid multibyte sequence of length 1 btowc returns WEOF.
output is affected by the current LC_TYPE locale.
/* * btowc example code * http://code-reference.com/c/wchar.h/btowc */ #include <stdio.h> #include <wchar.h> int main( void ) { char string[] = "btowc \x65xampl\x65"; int i; for ( i = 0; i < 13; ++i) { printf("%c %c\n", string[i], (wchar_t)btowc(string[i]) ); } return 0; }
b b t t o o w w c c e e x x a a m m p p l l e e