User Tools

Site Tools


Programming Reference/Librarys

Question & Answer

Q&A is closed



   #include <wchar.h>
   wint_t btowc(int);


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
#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

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/wchar.h/btowc.txt · Last modified: 2024/02/16 01:05 (external edit)

Impressum Datenschutz