.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
.TH "WCTOMB" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" wctomb
.SH PROLOG
This manual page is part of the POSIX Programmer's Manual.
The Linux implementation of this interface may differ (consult
the corresponding Linux manual page for details of Linux behavior),
or the interface may not be implemented on Linux.
.SH NAME
wctomb \- convert a wide-character code to a character
.SH SYNOPSIS
.LP
\fB#include <stdlib.h>
.br
.sp
int wctomb(char *\fP\fIs\fP\fB, wchar_t\fP \fIwchar\fP\fB);
.br
\fP
.SH DESCRIPTION
.LP
The \fIwctomb\fP() function shall determine the number of bytes needed
to represent the character corresponding to the
wide-character code whose value is \fIwchar\fP (including any change
in the shift state). It shall store the character
representation (possibly multiple bytes and any special bytes to change
shift state) in the array object pointed to by \fIs\fP (if
\fIs\fP is not a null pointer). At most {MB_CUR_MAX} bytes shall be
stored. If \fIwchar\fP is 0, a null byte shall be stored,
preceded by any shift sequence needed to restore the initial shift
state, and \fIwctomb\fP() shall be left in the initial shift
state.
.LP
The
behavior of this function is affected by the \fILC_CTYPE\fP category
of the current locale. For a state-dependent encoding, this
function shall be placed into its initial state by a call for which
its character pointer argument, \fIs\fP, is a null pointer.
Subsequent calls with \fIs\fP as other than a null pointer shall cause
the internal state of the function to be altered as
necessary. A call with \fIs\fP as a null pointer shall cause this
function to return a non-zero value if encodings have state
dependency, and 0 otherwise. Changing the \fILC_CTYPE\fP category
causes the shift state of this function to be unspecified.
.LP
The \fIwctomb\fP() function need not be reentrant. A function that
is not required to be reentrant is not required to be
thread-safe.
.LP
The implementation shall behave as if no function defined in this
volume of IEEE\ Std\ 1003.1-2001 calls
\fIwctomb\fP().
.SH RETURN VALUE
.LP
If \fIs\fP is a null pointer, \fIwctomb\fP() shall return a non-zero
or 0 value, if character encodings, respectively, do or
do not have state-dependent encodings. If \fIs\fP is not a null pointer,
\fIwctomb\fP() shall return -1 if the value of
\fIwchar\fP does not correspond to a valid character, or return the
number of bytes that constitute the character corresponding to
the value of \fIwchar\fP.
.LP
In no case shall the value returned be greater than the value of the
{MB_CUR_MAX} macro.
.SH ERRORS
.LP
No errors are defined.
.LP
\fIThe following sections are informative.\fP
.SH EXAMPLES
.LP
None.
.SH APPLICATION USAGE
.LP
None.
.SH RATIONALE
.LP
None.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fImblen\fP(), \fImbtowc\fP(), \fImbstowcs\fP(), \fIwcstombs\fP(),
the Base Definitions volume of
IEEE\ Std\ 1003.1-2001, \fI<stdlib.h>\fP
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .
|