[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions , 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 ( Storage WideCharacter)
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 (wcslen Subroutine) subroutine, wcstombs (wcstombs Subroutine) subroutine.

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


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]