wctomb

Converts a wide-character code to a multibyte character.

Library:LibC
Classification:ANSI
Service:General C Services

Syntax

  #include <stdlib.h> 
   
  int wctomb (
     char      *s,
     wchar_t    wchar);
  

Parameters

s

(OUT) Points to the multibyte character.

wchar

(IN) Specifies the wide-character code.

Return Values

If successful, returns the number of bytes in the wide-character code. Otherwise, returns one of the following:

  • If s is a NULL pointer, returns 0.

  • If wchar is not a valid character in the current locale, returns -1.

Remarks

The wctomb function determines the number of bytes required to represent the multibyte character corresponding to the code contained in wchar. If s is not a NULL pointer, the multibyte character representation is stored in the array pointed to by s. At most, MB_CUR_MAX characters are stored.

See Also

mbtowc