btowc - C wchar.h

C examples for wchar.h:btowc

Type

function

From


<cwchar>
<wchar.h>

Description

Convert single byte character to wide character

Prototype

wint_t btowc (int c);

Parameters

Parameter Description
c The int promotion of a byte.

Return Value

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.

Demo Code


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

Related Tutorials