Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ wctomb(3) — Digital UNIX 3.2c

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mblen(3)

mbstowcs(3)

mbtowc(3)

wcstombs(3)

wctomb(3)  —  Subroutines

NAME

wctomb − Converts a wide character into a multibyte character

LIBRARY

Standard C Library (libc.a)

SYNOPSIS

#include <stdlib.h>

int wctomb(
        char ∗s,
        wchar_t wchar);

PARAMETERS

sPoints to the location where the conversion is stored. 

wcharSpecifies the wide character to be converted. 

DESCRIPTION

The wctomb() function converts a wide character into a multibyte character. The wctomb() function stores no more than MB_CUR_MAX bytes. 

The behavior of the wctomb() function is affected by the LC_CTYPE category of the current locale.  In environments with shift-state dependent encoding, calls to the wctomb() function with the wchar parameter set to 0 (zero) put the function in its initial shift state. Subsequent calls with the wchar parameter set to nonzero values alter the state of the function as necessary.  Changing the LC_CTYPE category of the locale causes the shift state of the function to be unreliable. 

The implementation behaves as though no other function calls the wctomb() function. 

NOTES

AES Support Level:
Full use.

RETURN VALUES

When the s parameter is not a null pointer, the wctomb() function returns a value determined as follows:

       •If the wchar parameter corresponds to a valid multibyte character, the wctomb() function returns the number of bytes in the multibyte character. 

       •If the wchar parameter does not correspond to a valid multibyte character, the wctomb() function returns a value of -1, and sets errno to indicate the error. 

When the s parameter is a null pointer, the return value depends on the environment in the following way:

       •In environments where encoding is not state dependent, wctomb() returns a value of 0 (zero). 

       •In environments where encoding is state dependent, wctomb() returns a nonzero value. 

In no case is the returned value greater than the value of MB_CUR_MAX. 

ERRORS

If any of the following conditions occur, the wctomb() function sets errno to the corresponding value:

[EILSEQ]The wchar parameter does not correspond to a valid multibyte character. 

RELATED INFORMATION

Functions: mblen(3), mbstowcs(3), mbtowc(3), wcstombs(3). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026