totn C Functions

C Language: wctomb function
(Convert Wide Character to Multibyte Character)

In the C Programming Language, the wctomb function converts a wide character (as pointed to by wchar) into a multibyte character (as pointed to by s).

Syntax

The syntax for the wctomb function in the C Language is:

int wctomb(char *s, wchar_t wchar);

Parameters or Arguments

s
The array where the converted multibyte character will be stored.
wchar
The wide character to convert into a multibyte character.

Note

  • If s is a null pointer, the wctomb function will initialize the shift state.

Returns

The wctomb function returns the number of bytes in the character if wchar corresponds to a valid multibyte character. Otherwise, the wctomb function will return -1.

Required Header

In the C Language, the required header for the wctomb function is:

#include <stdlib.h>

Applies To

In the C Language, the wctomb function can be used in the following versions:

  • ANSI/ISO 9899-1990

Similar Functions

Other C functions that are similar to the wctomb function:

See Also

Other C functions that are noteworthy when dealing with the wctomb function: