{{keywords>wiki library source code example reference}}
===== btowc =====
#include
wint_t btowc(int);
==== Description ====
convert a byte to wide character
btowc returns the wide two byte character "wchar_t" converted from the single byte "string" character (char).
=== return value ===
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 C Sourcecode Example =====
/*
* btowc example code
* http://code-reference.com/c/wchar.h/btowc
*/
#include
#include
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;
}
==== output ====
b b
t t
o o
w w
c c
e e
x x
a a
m m
p p
l l
e e