[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Base Operating System and Extensions Technical Reference, Volume 2

wctomb Subroutine

Purpose

Converts a wide character into a multibyte character.

Library

Standard C Library (libc.a)

Syntax

#include <stdlib.h>
int wctomb (StorageWideCharacter)
char *Storage;
wchar_t WideCharacter;

Description

The wctomb subroutine determines the number of bytes required to represent the wide character specified by the WideCharacter parameter as the corresponding multibyte character. It then converts the WideCharacter value to a multibyte character and stores the results in the area pointed to by the Storage parameter. The wctomb subroutine can store a maximum of MB_CUR_MAX bytes in the area pointed to by the Storage parameter. Thus, the length of the area pointed to by the Storage parameter should be at least MB_CUR_MAX bytes. The MB_CUR_MAX macro is defined in the stdlib.h file.

Parameters

Storage Points to an area where the result of the conversion is stored.
WideCharacter Specifies a wide-character value.

Return Values

The wctomb subroutine returns a 0 if the Storage parameter is a null pointer. If the WideCharacter parameter does not correspond to a valid multibyte character, a -1 is returned. Otherwise, the number of bytes that comprise the multibyte character is returned.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The mbtowc subroutine, mbstowcs subroutine, wcslen subroutine, wcstombs subroutine.

National Language Support Overview for Programming, Subroutines Overview, Understanding Multibyte Code and Wide Character Code Conversion Subroutines in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]